}
int timeout = params.getConnectionTimeout();
if (timeout == 0) {
return createSocket(host, port, localAddress, localPort);
} else {
TimedSocket socket = new TimedSocket();
socket.bind(new InetSocketAddress(localAddress, localPort));
socket.connect(new InetSocketAddress(host, port), timeout);
return sslFactory.createSocket(socket, host, port, true);
}
}