public Socket createSocket(Socket socket,
String host,
int port,
boolean autoClose) throws IOException, UnknownHostException {
javax.net.ssl.SSLSocketFactory socketfactory =
(javax.net.ssl.SSLSocketFactory) javax.net.ssl.SSLSocketFactory.getDefault();
return socketfactory.createSocket(socket, host, port, autoClose);
}
|
public Socket createSocket(String host,
int port,
InetAddress localAddress,
int localPort,
HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
if (params == null) {
throw new IllegalArgumentException("Parameters may not be null");
}
int timeout = HttpConnectionParams.getConnectionTimeout(params);
if (timeout != 0) {
throw new IllegalStateException("Connection timeout is not supported in old IO mode");
}
javax.net.ssl.SSLSocketFactory socketfactory =
(javax.net.ssl.SSLSocketFactory) javax.net.ssl.SSLSocketFactory.getDefault();
if (localAddress != null) {
return socketfactory.createSocket(host, port, localAddress, localPort);
} else {
return socketfactory.createSocket(host, port);
}
}
Attempts to get a new socket connection to the given host within the given time limit. |