java.net
Class SocksSocketImplFactory

java.lang.Object
  extended byjava.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:
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
private  void checkProps()
           
 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
See Also:
Constant Field Values

PROTO_VERS

public static final int PROTO_VERS
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

NO_AUTH

public static final int NO_AUTH
See Also:
Constant Field Values

GSSAPI

public static final int GSSAPI
See Also:
Constant Field Values

USER_PASSW

public static final int USER_PASSW
See Also:
Constant Field Values

NO_METHODS

public static final int NO_METHODS
See Also:
Constant Field Values

CONNECT

public static final int CONNECT
See Also:
Constant Field Values

BIND

public static final int BIND
See Also:
Constant Field Values

UDP_ASSOC

public static final int UDP_ASSOC
See Also:
Constant Field Values

IPV4

public static final int IPV4
See Also:
Constant Field Values

DOMAIN_NAME

public static final int DOMAIN_NAME
See Also:
Constant Field Values

IPV6

public static final int IPV6
See Also:
Constant Field Values

REQUEST_OK

public static final int REQUEST_OK
See Also:
Constant Field Values

GENERAL_FAILURE

public static final int GENERAL_FAILURE
See Also:
Constant Field Values

NOT_ALLOWED

public static final int NOT_ALLOWED
See Also:
Constant Field Values

NET_UNREACHABLE

public static final int NET_UNREACHABLE
See Also:
Constant Field Values

HOST_UNREACHABLE

public static final int HOST_UNREACHABLE
See Also:
Constant Field Values

CONN_REFUSED

public static final int CONN_REFUSED
See Also:
Constant Field Values

TTL_EXPIRED

public static final int TTL_EXPIRED
See Also:
Constant Field Values

CMD_NOT_SUPPORTED

public static final int CMD_NOT_SUPPORTED
See Also:
Constant Field Values

ADDR_TYPE_NOT_SUP

public static final int ADDR_TYPE_NOT_SUP
See Also:
Constant Field Values
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

checkProps

private void checkProps()

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:
SocketImpl