common/src/main/java/HTTPClient/SocksClient.java
/**
     * Connect to the host/port, trying all addresses assciated with that
     * host.
     *
     * @param host      the host you wish to connect to
     * @param port      the port you wish to connect to
     * @param localAddr the local address to bind to
     * @param localPort the local port to bind to
     * @return the Socket
     * @exception IOException if the connection could not be established
     */
Connect to the host/port, trying all addresses assciated with that
host.


Connect to the host / port trying all addresses assciated with that host .
private static final Socket connect(String host, int port,
					InetAddress localAddr, int localPort)
	    throws IOException
    {
	InetAddress[] addr_list = InetAddress.getAllByName(host);
	for (int idx=0; idx<addr_list.length; idx++)
	{
	    try
	    {
		if (localAddr == null)
		    return new Socket(addr_list[idx], port);
		else
		    return new Socket(addr_list[idx], port, localAddr, localPort);
	    }
	    catch (SocketException se)
	    {
		if (idx < addr_list.length-1)
		    continue;	
		else
		    throw se;	
	    }
	}
	return null;	
    }
private static final Socket connect ( String host , int port , InetAddress localAddr , int localPort ) throws IOException { InetAddress [ ] addr_list = InetAddress . getAllByName ( host ) ; for ( int idx = 0 ; idx < addr_list . length ; idx ++ ) { try { if ( localAddr == null ) return new Socket ( addr_list [ idx ] , port ) ; else return new Socket ( addr_list [ idx ] , port , localAddr , localPort ) ; } catch ( SocketException se ) { if ( idx < addr_list . length - 1 ) continue ; else throw se ; } } return null ; }
Connect to the host/port, trying all addresses assciated with that
 host.
Connect to the host / port trying all addresses assciated with that host .
// try next IP address // none of them worked // never reached - just here to shut up the compiler