Code example for SocketFactory

Methods: createSocket

0
public class PollingProtocolSocketFactory implements SchemeSocketFactory { 
 
	private final static SocketFactory factory = SocketFactory.getDefault();
 
	public Socket createSocket(HttpParams params) throws IOException {
		return NetUtil.configureSocket(factory.createSocket());
	} 
 
	public Socket connectSocket(Socket sock, InetSocketAddress remoteAddress, InetSocketAddress localAddress,
			HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
 
		if (params == null) {
			throw new IllegalArgumentException("Parameters may not be null"); //$NON-NLS-1$
		} 
 
		final Socket socket = sock != null ? sock : NetUtil.configureSocket(factory.createSocket());
 
		int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
 
		socket.bind(localAddress);
Contextual code suggestions in your IDE  Get Codota for Java