socketGroupInfo.setConnectPort(connectPort);
socketGroupInfo.addClientInvoker(this);
// We got socketGroupInfo by socketGroupId. Make sure it is also stored by AddressPair.
bindHost = bindAddress.getHostName();
addressPair = new AddressPair(connectHost, connectPort, bindHost, bindPort);
MultiplexServerInvoker.getAddressPairMap().put(addressPair, socketGroupInfo);
MultiplexServerInvoker serverInvoker = socketGroupInfo.getServerInvoker();
if (serverInvoker != null)
serverInvoker.finishStart();
finishStart();
return;
}
bindHost = (String) parameters.get(Multiplex.MULTIPLEX_BIND_HOST);
bindPortString = (String) parameters.get(Multiplex.MULTIPLEX_BIND_PORT);
if (bindHost != null && bindPortString == null)
{
bindPortString = "0";
}
if (bindHost == null && bindPortString != null)
{
bindHost = "localhost";
}
if (bindHost != null)
{
log.debug("client rule 2");
try
{
bindPort = Integer.parseInt(bindPortString);
}
catch (NumberFormatException e)
{
throw new IOException("number format error for bindPort: " + bindPortString);
}
if (bindPort != 0)
{
bindSocketAddress = new InetSocketAddress(bindHost, bindPort);
addressPair = new AddressPair(connectHost, connectPort, bindHost, bindPort);
socketGroupInfo = (SocketGroupInfo) MultiplexServerInvoker.getAddressPairMap().get(addressPair);
}
// If socketGroupInfo exists, it's because it was created, along with a priming socket, by a
// MultiplexServerInvoker. Note that we don't look for a match if the bind port was