com.sshtools.net
Class HttpProxyTransport

java.lang.Object
  extended by java.net.Socket
      extended by com.sshtools.net.HttpProxyTransport
All Implemented Interfaces:
SshIO, SshTransport

public class HttpProxyTransport
extends Socket
implements SshTransport

Provides an SshTransport implementation that can route the connection through a HTTP proxy. To connect the transport simply call the connectViaProxy(String, int, String, int, String, String, String) method. You can pass the name of your application as the user agent and if no authentication is required simply pass ""

Author:
Lee David Painter

Method Summary
static HttpProxyTransport connectViaProxy(String host, int port, String proxyHost, int proxyPort, String username, String password, String userAgent)
          Connect the socket to a HTTP proxy and request forwarding to our remote host.
static HttpProxyTransport connectViaProxy(String host, int port, String proxyHost, int proxyPort, String username, String password, String userAgent, Hashtable optionalHeaders)
           
 SshTransport duplicate()
           
 String getHost()
           
 String toString()
           
 
Methods inherited from class java.net.Socket
bind, close, connect, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.maverick.ssh.SshTransport
getPort
 
Methods inherited from interface com.maverick.ssh.SshIO
close, getInputStream, getOutputStream
 

Method Detail

connectViaProxy

public static HttpProxyTransport connectViaProxy(String host,
                                                 int port,
                                                 String proxyHost,
                                                 int proxyPort,
                                                 String username,
                                                 String password,
                                                 String userAgent)
                                          throws IOException,
                                                 UnknownHostException
Connect the socket to a HTTP proxy and request forwarding to our remote host.

Parameters:
host -
port -
proxyHost -
proxyPort -
username -
password -
userAgent -
Returns:
HttpProxyTransport
Throws:
IOException
UnknownHostException

connectViaProxy

public static HttpProxyTransport connectViaProxy(String host,
                                                 int port,
                                                 String proxyHost,
                                                 int proxyPort,
                                                 String username,
                                                 String password,
                                                 String userAgent,
                                                 Hashtable optionalHeaders)
                                          throws IOException,
                                                 UnknownHostException
Parameters:
host -
port -
proxyHost -
proxyPort -
username -
password -
userAgent -
optionalHeaders -
Returns:
Throws:
IOException
UnknownHostException

toString

public String toString()
Overrides:
toString in class Socket

getHost

public String getHost()
Specified by:
getHost in interface SshTransport

duplicate

public SshTransport duplicate()
                       throws IOException
Specified by:
duplicate in interface SshTransport
Throws:
IOException


Copyright © 2012. All Rights Reserved.