id = new GUID().toString();
config.put(Client.ENABLE_LEASE, String.valueOf(clientPing));
   public JMSRemotingConnection(String serverLocatorURI, boolean clientPing) throws Throwable   {      this.clientPing = clientPing;      id = new GUID().toString();      callbackManager = new CallbackManager();      serverLocator = new InvokerLocator(serverLocatorURI);      thisAddress = InetAddress.getLocalHost().getHostAddress();      isMultiplex = serverLocator.getProtocol().equals("multiplex");      isSSL = serverLocator.getProtocol().equals("sslsocket");      serializationType = (String)serverLocator.getParameters().get("serializationtype");      final int MAX_RETRIES = 50;      boolean completed = false;      int count = 0;      while (!completed && count < MAX_RETRIES)      {         try         {            setUpConnection();            completed = true;         }         catch (Exception e)         {            log.warn("Failed to start connection", e);            // Intermittently we can fail to open a socket on the address since it's already in use            // This is despite remoting having checked the port is free. This is probably because            // of the small window between remoting checking the port is free and getting the            // port number and actually opening the connection during which some one else can use            // that port. Therefore we catch this and retry.            count++;            if (client != null)            {               client.disconnect();               log.trace("disconnected client");            }            if (callbackServer != null)            {               // Probably not necessary and may fail since it didn't get properly started               try               {                  callbackServer.stop();                  log.trace("stopped callback server");                  callbackServer.destroy();                  log.trace("destroyed callback server");                  callbackServer = null;               }               catch (Exception ignore)               {                  // Ignore - it may well fail - this is to be expected                  log.warn("Failed to shutdown callback server", ignore);               }            }            if (count == MAX_RETRIES)            {               final String msg = "Cannot start callbackserver after " + MAX_RETRIES + " retries";               log.error(msg, e);               throw new MessagingJMSException(msg, e);            }         }      }      log.debug(this + " created");   }