com.mindbright.net
Class WebProxyTunnelSocket

java.lang.Object
  extended by com.mindbright.net.WebProxyTunnelSocket

public class WebProxyTunnelSocket
extends java.lang.Object

Socket that implements web proxy tunnelling (using CONNECT). Note that the proxy setup is done in blocking mdoe so this will block until the socket is connected, or it gives up. Proxy-authentication in general, and Basic authentication, is described in RFC2616 and RFC2617. NTLM Authentication is described here: http://davenport.sourceforge.net/ntlm.html


Method Summary
static NetworkConnection getProxy(java.lang.String host, int port, java.lang.String proxyHost, int proxyPort, long proxyTimeout, ProxyAuthenticator authenticator, java.lang.String userAgent)
          Connect through an HTTP proxy.
static NetworkConnection getProxy(java.lang.String host, int port, java.lang.String proxyHost, int proxyPort, long proxyTimeout, java.lang.String protoStr, ProxyAuthenticator authenticator, java.lang.String userAgent)
          Connect through an HTTP proxy.
static NetworkConnection getProxy(java.lang.String host, int port, java.lang.String proxyHost, int proxyPort, ProxyAuthenticator authenticator, java.lang.String userAgent)
          Connect through an HTTP proxy.
static NetworkConnection getProxy(java.lang.String host, int port, java.lang.String proxyHost, int proxyPort, java.lang.String protoStr, ProxyAuthenticator authenticator, java.lang.String userAgent)
          Connect through an HTTP proxy.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getProxy

public static NetworkConnection getProxy(java.lang.String host,
                                         int port,
                                         java.lang.String proxyHost,
                                         int proxyPort,
                                         ProxyAuthenticator authenticator,
                                         java.lang.String userAgent)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException
Connect through an HTTP proxy. This method creates a NetworkConnection which is connected through the specified proxy. The connection may be authenticated. Note that the connection is done synchronously so this call will block until the connection is established.

Parameters:
host - Host we want to connect to
port - Port on host we want to connect to
proxyHost - Address or proxy server
proxyPort - Port on proxy server
authenticator - Used to authenticate (if needed)
userAgent - Which user agent we should present ourselves as to the proxy
Returns:
A NetworkConnection which is connected to the destination hos through the proxy.
Throws:
java.io.IOException
java.net.UnknownHostException

getProxy

public static NetworkConnection getProxy(java.lang.String host,
                                         int port,
                                         java.lang.String proxyHost,
                                         int proxyPort,
                                         long proxyTimeout,
                                         ProxyAuthenticator authenticator,
                                         java.lang.String userAgent)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException
Connect through an HTTP proxy. This method creates a NetworkConnection which is connected through the specified proxy. The connection may be authenticated. Note that the connection is done synchronously so this call will block until the connection is established.

Parameters:
host - Host we want to connect to
port - Port on host we want to connect to
proxyHost - Address or proxy server
proxyPort - Port on proxy server
proxyTimeout - How many milliseconds to wait before giving up when connecting.
authenticator - Used to authenticate (if needed)
userAgent - Which user agent we should present ourselves as to the proxy
Returns:
A NetworkConnection which is connected to the destination hos through the proxy.
Throws:
java.io.IOException
java.net.UnknownHostException

getProxy

public static NetworkConnection getProxy(java.lang.String host,
                                         int port,
                                         java.lang.String proxyHost,
                                         int proxyPort,
                                         java.lang.String protoStr,
                                         ProxyAuthenticator authenticator,
                                         java.lang.String userAgent)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException
Connect through an HTTP proxy. This method creates a NetworkConnection which is connected through the specified proxy. The connection may be authenticated. Note that the connection is done synchronously so this call will block until the connection is established.

Parameters:
host - Host we want to connect to
port - Port on host we want to connect to
proxyHost - Address or proxy server
proxyPort - Port on proxy server
protoStr - Extra string to preprend to host when issuing the CONNECT call
authenticator - Used to authenticate (if needed)
userAgent - Which user agent we should present ourselves as to the proxy
Returns:
A NetworkConnection which is connected to the destination hos through the proxy.
Throws:
java.io.IOException
java.net.UnknownHostException

getProxy

public static NetworkConnection getProxy(java.lang.String host,
                                         int port,
                                         java.lang.String proxyHost,
                                         int proxyPort,
                                         long proxyTimeout,
                                         java.lang.String protoStr,
                                         ProxyAuthenticator authenticator,
                                         java.lang.String userAgent)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException
Connect through an HTTP proxy. This method creates a NetworkConnection which is connected through the specified proxy. The connection may be authenticated. Note that the connection is done synchronously so this call will block until the connection is established.

Parameters:
host - Host we want to connect to
port - Port on host we want to connect to
proxyHost - Address or proxy server
proxyPort - Port on proxy server
proxyTimeout - How many milliseconds to wait before giving up when connecting.
protoStr - Extra string to preprend to host when issuing the CONNECT call
authenticator - Used to authenticate (if needed)
userAgent - Which user agent we should present ourselves as to the proxy
Returns:
A NetworkConnection which is connected to the destination hos through the proxy.
Throws:
java.io.IOException
java.net.UnknownHostException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object