protected Socket createSocket ( final String host , final int port , final int connectionTimeout ) throws IOException { final SocketFactory socketFactory = getSocketFactory ( proxy , false , false , connectionTimeout ) ; if ( connectionTimeout < 0 ) { return socketFactory . createSocket ( host , port ) ; } else { // creates unconnected socket Socket socket = socketFactory . createSocket ( ) ; socket . connect ( new InetSocketAddress ( host , port ) , connectionTimeout ) ; return socket ; } }
Creates a socket using socket factory .