public static BClient_Testser createClient(BWireFlags flags) { BClient_Testser client = null; try { ServicePointManager.DefaultConnectionLimit = 1000; BWire wire = new HWireClient(url, flags, 120); BTransportFactory transportFactory = new HTransportFactoryClient(BApiDescriptor_Testser.instance, wire, 1); client = BClient_Testser.createClient(transportFactory); BSyncResult <bool> syncResult = new BSyncResult <bool>(); client.start(BAsyncResultHelper.ToDelegate(syncResult)); syncResult.GetResult(); } catch (Exception e) { Assert.Fail(e.ToString()); } return(client); }
private void internalCreateConnection(IXAuthentication auth, BAsyncResult <IXConnection> asyncResult) { // Check version if (MajorVersion < 9) { BException ex = new BException(BExceptionC.CONNECTION_TO_SERVER_FAILED, "Received server version " + Version + ". At least server version 9.00.000 is required."); asyncResult(null, ex); return; } // IX-URL, e.g. http://localhost:8084/ix-elo80/ix String url = connProps[PROP_URL]; // BYPS-URL, e.g. http://localhost:8084/ix-elo80/byps String bypsUrl = url; int pos = bypsUrl.LastIndexOf("/ix"); if (pos >= 0) { bypsUrl = bypsUrl.Substring(0, pos) + "/byps"; if (pos + 3 < url.Length) { bypsUrl += url.Substring(pos + 3); } } // timeout String timeoutSecondsStr = connProps[PROP_TIMEOUT_SECONDS]; int timeoutSeconds = Convert.ToInt32(timeoutSecondsStr != null && timeoutSecondsStr.Length != 0 ? timeoutSecondsStr : "120"); // #reverse connections String reverseConnsStr = connProps[NB_OF_REVERSE_CNNS]; int nbOfReverseConnections = Convert.ToInt32(reverseConnsStr != null && reverseConnsStr.Length != 0 ? reverseConnsStr : "1"); // Wire, transport, client IXWireClient wire = new IXWireClient(bypsUrl, 0, timeoutSeconds); BTransportFactory transportFactory = new HTransportFactoryClient(BApiDescriptor_Indexserver.instance, wire, nbOfReverseConnections); BClient_Indexserver bclient = BClient_Indexserver.createClient(transportFactory); // Authentication bclient.setAuthentication(auth); // IXConnection IXConnection conn = new IXConnection(this, bclient, auth, url, connProps, sessOpts); BAsyncResult <bool> outerResult = (ignored, e) => { if (e != null) { asyncResult(conn, e); } else if (this.CONST != null) { asyncResult(conn, e); } else { // Read constants BAsyncResult <IXServicePortC> constResult = (CONST, ex) => { this.CONSTVal = CONST; asyncResult(conn, ex); }; conn.getCONST(constResult); } }; // Start client bclient.start(outerResult, false); }