java.net
Class SocksSocketImplFactory

java.lang.Object
  |
  +--java.net.SocksSocketImplFactory
All Implemented Interfaces:
SocketImplFactory, SocksConsts

class SocksSocketImplFactory
extends Object
implements SocketImplFactory, SocksConsts

This factory creates an SocketImpl that implements the SOCKS protocol (both V5 & V4). It implements RFC 1928.

See Also:
java.net.Socket#setSocketImplFactory(SocketImplFactory), java.net.ServerSocket#setSocketImplFactory(SocketImplFactory)

Field Summary
static int ADDR_TYPE_NOT_SUP
           
static int BIND
           
static int CMD_NOT_SUPPORTED
           
static int CONN_REFUSED
           
static int CONNECT
           
static int DEFAULT_PORT
           
static int DOMAIN_NAME
           
static int GENERAL_FAILURE
           
static int GSSAPI
           
static int HOST_UNREACHABLE
           
static int IPV4
           
static int IPV6
           
static int NET_UNREACHABLE
           
static int NO_AUTH
           
static int NO_METHODS
           
static int NOT_ALLOWED
           
private  int port
           
static int PROTO_VERS
           
static int PROTO_VERS4
           
static int REQUEST_OK
           
private  String server
           
static int TTL_EXPIRED
           
static int UDP_ASSOC
           
static int USER_PASSW
           
private  boolean useV4
           
 
Constructor Summary
(package private) SocksSocketImplFactory(String server, int port)
          Creates a SocksSocketImplFactory with a specific server & port.
(package private) SocksSocketImplFactory(String server, int port, boolean v4)
          Creates a SocksSocketImplFactory with a specific server & port.
 
Method Summary
 SocketImpl createSocketImpl()
          Creates a new SocketImpl instance.
private  void guessVersion()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

private String server

port

private int port

useV4

private boolean useV4

PROTO_VERS4

public static final int PROTO_VERS4

PROTO_VERS

public static final int PROTO_VERS

DEFAULT_PORT

public static final int DEFAULT_PORT

NO_AUTH

public static final int NO_AUTH

GSSAPI

public static final int GSSAPI

USER_PASSW

public static final int USER_PASSW

NO_METHODS

public static final int NO_METHODS

CONNECT

public static final int CONNECT

BIND

public static final int BIND

UDP_ASSOC

public static final int UDP_ASSOC

IPV4

public static final int IPV4

DOMAIN_NAME

public static final int DOMAIN_NAME

IPV6

public static final int IPV6

REQUEST_OK

public static final int REQUEST_OK

GENERAL_FAILURE

public static final int GENERAL_FAILURE

NOT_ALLOWED

public static final int NOT_ALLOWED

NET_UNREACHABLE

public static final int NET_UNREACHABLE

HOST_UNREACHABLE

public static final int HOST_UNREACHABLE

CONN_REFUSED

public static final int CONN_REFUSED

TTL_EXPIRED

public static final int TTL_EXPIRED

CMD_NOT_SUPPORTED

public static final int CMD_NOT_SUPPORTED

ADDR_TYPE_NOT_SUP

public static final int ADDR_TYPE_NOT_SUP
Constructor Detail

SocksSocketImplFactory

SocksSocketImplFactory(String server,
                       int port)
Creates a SocksSocketImplFactory with a specific server & port. This should point to a SOCKS v5 proxy server.

Parameters:
server - the server hostname
port - the port number. -1 for the default SOCKS port.

SocksSocketImplFactory

SocksSocketImplFactory(String server,
                       int port,
                       boolean v4)
Creates a SocksSocketImplFactory with a specific server & port.

Parameters:
server - the server hostname
port - the port number. -1 for the default SOCKS port.
v4 - true if the protocol should be version 4 false for version 5.
Method Detail

guessVersion

private void guessVersion()

createSocketImpl

public SocketImpl createSocketImpl()
Creates a new SocketImpl instance.

Specified by:
createSocketImpl in interface SocketImplFactory
Returns:
a new instance of SocketImpl.
See Also:
java.net.SocketImpl


comments?