CertificateException, UnrecoverableKeyException,
KeyManagementException
{
// Acquire the server socket factory for this Connector
ServerSocketFactory factory = getFactory();
// If no address is specified, open a connection on all addresses
if (address == null) {
log(sm.getString("httpConnector.allAddresses"));
return (factory.createSocket(port, acceptCount));
}
// Open a server socket on the specified address
InetAddress[] addresses =
InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
int i;
for (i = 0; i < addresses.length; i++) {
if (addresses[i].getHostAddress().equals(address))
break;
}
if (i < addresses.length) {
log(sm.getString("httpConnector.anAddress", address));
return (factory.createSocket(port, acceptCount, addresses[i]));
} else {
log(sm.getString("httpConnector.noAddress", address));
return (factory.createSocket(port, acceptCount));
}
}