public static Socket standardSocket ( UrlParser urlParser , String host ) throws IOException { SocketFactory socketFactory ; String socketFactoryName = urlParser . getOptions ( ) . socketFactory ; if ( socketFactoryName != null ) { try { @ SuppressWarnings ( "unchecked" ) Class < ? extends SocketFactory > socketFactoryClass = ( Class < ? extends SocketFactory > ) Class . forName ( socketFactoryName ) ; if ( socketFactoryClass != null ) { Constructor < ? extends SocketFactory > constructor = socketFactoryClass . getConstructor ( ) ; socketFactory = constructor . newInstance ( ) ; return socketFactory . createSocket ( ) ; } } catch ( Exception exp ) { throw new IOException ( "Socket factory failed to initialized with option \"socketFactory\" set to \"" + urlParser . getOptions ( ) . socketFactory + "\"" , exp ) ; } } socketFactory = SocketFactory . getDefault ( ) ; return socketFactory . createSocket ( ) ; }
Use standard socket implementation .