String callbackServerURI = "socket:  InvokerLocator callbackServerLocator = new InvokerLocator(callbackServerURI);                              serverURI = serverLocatorURI; InvokerLocator serverLocator = new InvokerLocator(serverLocatorURI);  if (log.isTraceEnabled()) { log.trace("Connecting with server URI:" + serverURI); }  client = new Client(serverLocator);  if (log.isTraceEnabled()) { log.trace("Created client"); }      callbackServer = new Connector();  if (log.isTraceEnabled()) { log.trace("Starting virtual callback server with uri:" + callbackServerLocator.getLocatorURI()); }  callbackServer.setInvokerLocator(callbackServerLocator.getLocatorURI());  callbackServer.create();  callbackServer.start();  if (log.isTraceEnabled()) { log.trace("Created callback server"); }  client.connect();
this.remotingConnection = remotingConnection;
   public ConnectionState(ConnectionDelegate delegate, String serverId, String serverLocatorURI)      throws Exception   {      super(null, delegate);            if (log.isTraceEnabled()) { log.trace("Creating connection state"); }            children = new SyncSet(new HashSet(), new WriterPreferenceReadWriteLock());            resourceManager = ResourceManagerFactory.instance.getResourceManager(serverId);            //TODO size should be configurable      pooledExecutor = new PooledExecutor(new LinkedQueue(), 50);      pooledExecutor.setMinimumPoolSize(50);                  //NOTE      //Multiplex code is commented out and we have reverted to socket transport until      //it is fixed                        //      String guid = new GUID().toString();//      //      int bindPort;//      //      synchronized (PortUtil.class)//      {//         bindPort = PortUtil.findFreePort();//      }      //      String callbackServerURI = "multiplex://0.0.0.0:" + bindPort + "/?serverMultiplexId=" + guid;            String callbackServerURI = "socket://0.0.0.0:0";                  InvokerLocator callbackServerLocator = new InvokerLocator(callbackServerURI);            //Create a Client for invoking on the server      //The same Client is used for all server invocations for all "child objects" of the connection            //String bindHost = callbackServerLocator.getHost();//      InvokerLocator dummy = new InvokerLocator(serverLocatorURI);//      String serverHost = dummy.getHost();//      int serverPort = dummy.getPort();//      Map serverParams = dummy.getParameters();//      String protocol = dummy.getProtocol();//      //      serverURI = protocol + "://" + serverHost + ":" + serverPort +//         "/?bindHost=" + bindHost + "&bindPort=" + bindPort + "&clientMultiplexId=" + guid;//      //      if (serverParams != null && !serverParams.isEmpty())//      {//         Iterator iter = serverParams.entrySet().iterator();//         while (iter.hasNext())//         {//            Map.Entry entry = (Map.Entry)iter.next();//            String key = (String)entry.getKey();//            String value = (String)entry.getValue();//            serverURI += "&" + key + "=" + value;//         }//      }//                                 //      InvokerLocator serverLocator =  new InvokerLocator(serverURI);            //            serverURI = serverLocatorURI;      InvokerLocator serverLocator = new InvokerLocator(serverLocatorURI);            if (log.isTraceEnabled()) { log.trace("Connecting with server URI:" + serverURI); }                  client = new Client(serverLocator);      if (log.isTraceEnabled()) { log.trace("Created client"); }            //We create a "virtual" callback server on the client.      //This doesn't actually create a "real" server listening with any      //real server sockets.                       callbackServer = new Connector();                   if (log.isTraceEnabled()) { log.trace("Starting virtual callback server with uri:"             + callbackServerLocator.getLocatorURI()); }                  callbackServer.setInvokerLocator(callbackServerLocator.getLocatorURI());            callbackServer.create();            callbackServer.start();            if (log.isTraceEnabled()) { log.trace("Created callback server"); }            client.connect();                        }