// Anonymous bind port
if (bindPort == 0)
bindPort = PortUtil.findFreePort(bindHost);
socketGroupInfo = new SocketGroupInfo();
socketGroupInfo.setConnectAddress(connectAddress);
socketGroupInfo.setConnectPort(connectPort);
socketGroupInfo.addClientInvoker(this);
// Set bindAddress and bindPort to be able to test for inconsistencies with bind address
// and bind port determined by companion MultiplexServerInvoker.
bindAddress = InetAddress.getByName(bindHost);
socketGroupInfo.setBindAddress(bindAddress);
socketGroupInfo.setBindPort(bindPort);
String connectHost = connectAddress.getHostName();
MultiplexServerInvoker.createPrimingSocket(socketGroupInfo, connectHost, connectPort,
bindAddress, bindPort, configuration, timeout);
MultiplexServerInvoker.getAddressPairMap().put(addressPair, socketGroupInfo);
if (socketGroupId != null)
{
socketGroupInfo.setSocketGroupId(socketGroupId);
MultiplexServerInvoker.getSocketGroupMap().put(socketGroupId, socketGroupInfo);
}
finishStart();
return;
}
if (socketGroupId != null)
{
log.debug("client rule 3");
if (socketGroupInfo == null)
{
socketGroupInfo = new SocketGroupInfo();
socketGroupInfo.setSocketGroupId(socketGroupId);
socketGroupInfo.setConnectAddress(connectAddress);
socketGroupInfo.setConnectPort(connectPort);
MultiplexServerInvoker.getSocketGroupMap().put(socketGroupId, socketGroupInfo);
}
socketGroupInfo.addClientInvoker(this);
return;
}
log.debug("client rule 4");
String connectHost = connectAddress.getHostName();
socketGroupInfo = new SocketGroupInfo();
MultiplexServerInvoker.createPrimingSocket(socketGroupInfo, connectHost, connectPort,
configuration, timeout);
finishStart();
}
}