com.sshtools.net
Class SocksProxyTransport

java.lang.Object
  extended byjava.net.Socket
      extended bycom.sshtools.net.SocksProxyTransport
All Implemented Interfaces:
SshIO, SshTransport

public class SocksProxyTransport
extends java.net.Socket
implements SshTransport

Provides an SshTransport implementation that can route the connection through a SOCKS 4 or SOCKS 5 proxy.

Author:
Lee David Painter

Field Summary
static int SOCKS4
           
static int SOCKS5
           
 
Method Summary
static SocksProxyTransport connectViaSocks4Proxy(java.lang.String remoteHost, int remotePort, java.lang.String proxyHost, int proxyPort, java.lang.String userId)
          Connect the socket to a SOCKS 4 proxy and request forwarding to our remote host.
static SocksProxyTransport connectViaSocks5Proxy(java.lang.String remoteHost, int remotePort, java.lang.String proxyHost, int proxyPort, boolean localLookup, java.lang.String username, java.lang.String password)
          Connect the socket to a SOCKS 5 proxy and request forwarding to our remote host.
static SocksProxyTransport connectViaSocks5Proxy(java.lang.String remoteHost, int remotePort, java.lang.String proxyHost, int proxyPort, java.lang.String username, java.lang.String password)
           
 SshTransport duplicate()
          Create a new copy of this transport and connect to the same host:port combination.
 java.lang.String getHost()
          Get the name of the connected host.
 java.lang.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, 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
 

Field Detail

SOCKS4

public static final int SOCKS4
See Also:
Constant Field Values

SOCKS5

public static final int SOCKS5
See Also:
Constant Field Values
Method Detail

connectViaSocks4Proxy

public static SocksProxyTransport connectViaSocks4Proxy(java.lang.String remoteHost,
                                                        int remotePort,
                                                        java.lang.String proxyHost,
                                                        int proxyPort,
                                                        java.lang.String userId)
                                                 throws java.io.IOException,
                                                        java.net.UnknownHostException
Connect the socket to a SOCKS 4 proxy and request forwarding to our remote host.

Parameters:
remoteHost -
remotePort -
proxyHost -
proxyPort -
userId -
Returns:
Throws:
java.io.IOException
java.net.UnknownHostException

connectViaSocks5Proxy

public static SocksProxyTransport connectViaSocks5Proxy(java.lang.String remoteHost,
                                                        int remotePort,
                                                        java.lang.String proxyHost,
                                                        int proxyPort,
                                                        boolean localLookup,
                                                        java.lang.String username,
                                                        java.lang.String password)
                                                 throws java.io.IOException,
                                                        java.net.UnknownHostException
Connect the socket to a SOCKS 5 proxy and request forwarding to our remote host.

Parameters:
remoteHost -
remotePort -
proxyHost -
proxyPort -
localLookup -
username -
password -
Returns:
Throws:
java.io.IOException
java.net.UnknownHostException

toString

public java.lang.String toString()

connectViaSocks5Proxy

public static SocksProxyTransport connectViaSocks5Proxy(java.lang.String remoteHost,
                                                        int remotePort,
                                                        java.lang.String proxyHost,
                                                        int proxyPort,
                                                        java.lang.String username,
                                                        java.lang.String password)
                                                 throws java.io.IOException,
                                                        java.net.UnknownHostException
Throws:
java.io.IOException
java.net.UnknownHostException

getHost

public java.lang.String getHost()
Description copied from interface: SshTransport
Get the name of the connected host.

Specified by:
getHost in interface SshTransport
Returns:
the name of the connected host

duplicate

public SshTransport duplicate()
                       throws java.io.IOException
Description copied from interface: SshTransport
Create a new copy of this transport and connect to the same host:port combination. This is used by the SshClient to duplicate a client connection.

Specified by:
duplicate in interface SshTransport
Returns:
Throws:
java.io.IOException


Copyright © 2003 3SP LTD. All Rights Reserved.