if (connectionDelegate != null)
if (connectionDelegate != null && connectionDelegate.getState() == null)
   public Object handleCreateConnectionDelegate(Invocation inv) throws Throwable   {      ConnectionFactoryDelegate cfd = (ConnectionFactoryDelegate)inv.getTargetObject();      CreateConnectionResult res = (CreateConnectionResult)inv.invokeNext();      if(trace) { log.trace("got " + res + " on return"); }      ClientConnectionDelegate connectionDelegate = (ClientConnectionDelegate)res.getDelegate();      if (connectionDelegate != null)      {         connectionDelegate.init();         int serverID = connectionDelegate.getServerID();         Version versionToUse = connectionDelegate.getVersionToUse();         JMSRemotingConnection remotingConn = connectionDelegate.getRemotingConnection();         if (versionToUse == null)         {            throw new IllegalStateException("Connection version is null");         }         // We have one message id generator per unique server         MessageIdGenerator g = MessageIdGeneratorFactory.instance.checkOutGenerator(serverID, cfd);         ConnectionState connectionState =            new ConnectionState(serverID, connectionDelegate, remotingConn, versionToUse, g);         connectionDelegate.setState(connectionState);      }      return res;   }