Sun Adapter for Batch/FTP

com.stc.eways.batchext
Class Socks

java.lang.Object
  extended by com.stc.eways.batchext.Socks
All Implemented Interfaces:
SocksProxy

public class Socks
extends java.lang.Object
implements SocksProxy

This implementation is for the SOCKS (V4, V4A & V5) protocol.

Version:
cvs revision: $Revision: 1.5 $ Last Modified: $Date: 2008/02/25 16:56:24 $
Author:
Harry Liu

Field Summary
 
Fields inherited from interface com.stc.eways.batchext.SocksProxy
ADDR_TYPE_DOMAINNAME, ADDR_TYPE_IP_V4, ADDR_TYPE_IP_V6, CMD_FLAG, COMMAND_BIND, COMMAND_CONNECT, COMMAND_UDP_ASSOCIATE, DEFAULT_PORT, METHOD_CHAP, METHOD_GSSAPI, METHOD_NO_ACCEPTABLE_METHODS, METHOD_NO_AUTHENTICATION_REQUIRED, METHOD_USERNAME_PASSWORD, NULL_IND, REPLY_V4_GRANTED, REPLY_V4_REJECTED, REPLY_V4_REJECTED_DIFF_IDENTS, REPLY_V4_REJECTED_NO_IDENTD, REPLY_V5_ADDRESS_TYPE_NOT_SUPPORTED, REPLY_V5_COMMAND_NOT_SUPPORTED, REPLY_V5_FAILURE, REPLY_V5_HOST_UNREACHABLE, REPLY_V5_INVALID_ADDRESS, REPLY_V5_NETWORK_UNREACHABLE, REPLY_V5_NOT_ALLOWED, REPLY_V5_REFUSED, REPLY_V5_SUCCEEDED, REPLY_V5_TTL_EXPIRED, UDP_FLAG_INTERFACE_REQUEST, UDP_FLAG_USECLIENTSPORT, UDP_INTERFACE_DATA, VERSION_4, VERSION_4A, VERSION_5, VERSION_UNKNOWN
 
Constructor Summary
Socks(java.lang.String socksHost, int socksPort, java.lang.String socksUser, java.lang.String socksPassword)
          Creates the SOCKS proxy server if the SOCKS version is unknown.
Socks(java.lang.String socksHost, int socksPort, java.lang.String socksUser, java.lang.String socksPassword, int socksVersion)
          Creates the SOCKS proxy server.
Socks(java.lang.String socksHost, java.lang.String socksUser, java.lang.String socksPassword)
          Creates the SOCKS proxy server using the default SOCKS port (1080).
Socks(java.lang.String socksHost, java.lang.String socksUser, java.lang.String socksPassword, int socksVersion)
          Creates the SOCKS proxy server using the default SOCKS port (1080).
 
Method Summary
 boolean equals(Socks socks)
          Indicates whether some other SOCKS object is "equal to" the current one.
 java.lang.String getSocksHost()
          Gets the host name on which the SOCKS server is running.
 java.lang.String getSocksPassword()
          Gets the encrypted password for the SOCKS user.
 int getSocksPort()
          Gets the port on which SOCKS server is running.
 java.lang.String getSocksUser()
          Gets the SOCKS user name.
 int getSocksVersion()
          Gets the SOCKS version; 4, 5 or -1 is returned.
static void main(java.lang.String[] args)
          Used to do stand-alone testing.
 void setSocksVersion(int newSocksVersion)
          Sets the SOCKS version; 4, 5 or -1 is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Socks

public Socks(java.lang.String socksHost,
             int socksPort,
             java.lang.String socksUser,
             java.lang.String socksPassword)
Creates the SOCKS proxy server if the SOCKS version is unknown. The e*Way tries to find the version according to the response of the SOCKS server.

Parameters:
socksHost - The host name of the SOCKS server.
socksPort - The port number of the SOCKS server
socksUser - The user name.
socksPassword - The encrypted password for that user.

Socks

public Socks(java.lang.String socksHost,
             int socksPort,
             java.lang.String socksUser,
             java.lang.String socksPassword,
             int socksVersion)
Creates the SOCKS proxy server.

Parameters:
socksHost - The host name of the SOCKS server.
socksPort - The port number of the SOCKS server
socksUser - The user name.
socksPassword - The encrypted password for that user.
socksVersion - The SOCKS version: 4, 5 or -1 (-1 means an unknown version, and the e*Way tries to find it according to the response of the SOCKS server).

Socks

public Socks(java.lang.String socksHost,
             java.lang.String socksUser,
             java.lang.String socksPassword)
Creates the SOCKS proxy server using the default SOCKS port (1080). If the SOCKS version is unknown, the e*Way tries to find it according to the response from the SOCKS server.

Parameters:
socksHost - The host name of the SOCKS server.
socksUser - The user name.
socksPassword - The encrypted password for that user.

Socks

public Socks(java.lang.String socksHost,
             java.lang.String socksUser,
             java.lang.String socksPassword,
             int socksVersion)
Creates the SOCKS proxy server using the default SOCKS port (1080).

Parameters:
socksHost - The host name of the SOCKS server.
socksUser - The user name.
socksPassword - The encrypted password for that user.
socksVersion - The SOCKS version: 4, 5 or -1 (-1 means an unknown version, and the e*Way tries to find it according to the response of the SOCKS server).
Method Detail

getSocksHost

public java.lang.String getSocksHost()
Gets the host name on which the SOCKS server is running.

Returns:
The SOCKS host name.

getSocksPassword

public java.lang.String getSocksPassword()
Gets the encrypted password for the SOCKS user.


getSocksPort

public int getSocksPort()
Gets the port on which SOCKS server is running.

Returns:
The SOCKS host port number.

getSocksUser

public java.lang.String getSocksUser()
Gets the SOCKS user name.

Returns:
The user name.

getSocksVersion

public int getSocksVersion()
Gets the SOCKS version; 4, 5 or -1 is returned. A -1 means the SOCKS version is unknown, and the e*Way tries to find it according to the response from the SOCKS server.

Returns:
The SOCKS version.

setSocksVersion

public void setSocksVersion(int newSocksVersion)
                     throws SocksException
Sets the SOCKS version; 4, 5 or -1 is used. A -1 means the SOCKS version is unknown, and the e*Way tries to find it according to the response from the SOCKS server.

Parameters:
newSocksVersion - The SOCKS version, that is, 4, 5 or -1 (-1 means an unknown version).
Throws:
SocksException

equals

public boolean equals(Socks socks)
Indicates whether some other SOCKS object is "equal to" the current one. A return of true means the two SOCKS objects have the same host names and port numbers. This method is used for the class SocksChain (it is invoked when SocksChain.add() is called).

Parameters:
socks - A SOCKS object.
Returns:
true or false.

main

public static void main(java.lang.String[] args)
Used to do stand-alone testing.

Parameters:
args - Command-line parameters.

Sun Adapter for Batch/FTP