nu.najt.kecon.jsocksproxy
Class JSocksProxy

java.lang.Object
  extended by nu.najt.kecon.jsocksproxy.JSocksProxy
All Implemented Interfaces:
JSocksProxyMBean

public class JSocksProxy
extends java.lang.Object
implements JSocksProxyMBean

This SOCKS proxy supports basic unauthenticated v4 and v5 versions.

Author:
Kenny Colliander Nordin

Nested Class Summary
protected  class JSocksProxy.ListeningThread
          This thread handle incoming connections for a specific listening address
 
Field Summary
static java.lang.String CONFIGURATION_XML
           
static long RELOAD_INTERVAL
           
 
Constructor Summary
JSocksProxy()
          Constructor
 
Method Summary
protected  void checkListeningThreads()
          Check that the listeningAddresses property matches all binding threads.
 java.lang.String getConfigurationBasePathPropertyKey()
           
 java.util.Set<SocksImplementation> getConnections()
           
static java.lang.String getIpAndPort(java.net.InetSocketAddress inetSocketAddress)
          Create a string representation of a InetSocketAddress
static java.lang.String getIpAndPort(java.net.Socket socket)
          Create a string representation of a Socket
 java.lang.String getJndiName()
           
 java.net.InetAddress getOutgoingSourceAddress()
           
 boolean isAllowSocks4()
           
 boolean isAllowSocks5()
           
static void main(java.lang.String[] args)
          The main method for this SocksImplementation.
 void readConfiguration()
          Reading and update configuration from configuration.xml
 void setConfigurationBasePathPropertyKey(java.lang.String configurationBasePathPropertyKey)
          Sets property key for the configuration base path
 void setJndiName(java.lang.String jndiName)
          Sets the jndiName
 void start()
          Start method
static void startService()
          Static start method
 void stop()
          Stop method
static void stopService()
          Static stop method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_XML

public static final java.lang.String CONFIGURATION_XML
See Also:
Constant Field Values

RELOAD_INTERVAL

public static final long RELOAD_INTERVAL
See Also:
Constant Field Values
Constructor Detail

JSocksProxy

public JSocksProxy()
Constructor

Method Detail

main

public static void main(java.lang.String[] args)
The main method for this SocksImplementation.

Parameters:
args - A String[] containing startup parameters.

getJndiName

public java.lang.String getJndiName()
Specified by:
getJndiName in interface JSocksProxyMBean
Returns:
the jndiName

setJndiName

public void setJndiName(java.lang.String jndiName)
                 throws javax.naming.NamingException
Description copied from interface: JSocksProxyMBean
Sets the jndiName

Specified by:
setJndiName in interface JSocksProxyMBean
Parameters:
jndiName - the jndiName
Throws:
javax.naming.NamingException

getConfigurationBasePathPropertyKey

public java.lang.String getConfigurationBasePathPropertyKey()
Specified by:
getConfigurationBasePathPropertyKey in interface JSocksProxyMBean
Returns:
the configuration base path property key

setConfigurationBasePathPropertyKey

public void setConfigurationBasePathPropertyKey(java.lang.String configurationBasePathPropertyKey)
Description copied from interface: JSocksProxyMBean
Sets property key for the configuration base path

Specified by:
setConfigurationBasePathPropertyKey in interface JSocksProxyMBean
Parameters:
configurationBasePathPropertyKey - the configuration base path property key

startService

public static void startService()
Static start method


stopService

public static void stopService()
Static stop method


start

public void start()
Start method

Specified by:
start in interface JSocksProxyMBean

stop

public void stop()
Stop method

Specified by:
stop in interface JSocksProxyMBean

checkListeningThreads

protected void checkListeningThreads()
Check that the listeningAddresses property matches all binding threads.


readConfiguration

public void readConfiguration()
Reading and update configuration from configuration.xml


getOutgoingSourceAddress

public java.net.InetAddress getOutgoingSourceAddress()
Returns:
the outgoing address

getConnections

public java.util.Set<SocksImplementation> getConnections()
Returns:
the connections

getIpAndPort

public static java.lang.String getIpAndPort(java.net.InetSocketAddress inetSocketAddress)
Create a string representation of a InetSocketAddress

Parameters:
inetSocketAddress - the address that should be represented
Returns:
the string representation

getIpAndPort

public static java.lang.String getIpAndPort(java.net.Socket socket)
Create a string representation of a Socket

Parameters:
socket - the address that should be represented
Returns:
the string representation

isAllowSocks4

public boolean isAllowSocks4()
Returns:
true if usage of SOCKS4 is allowed

isAllowSocks5

public boolean isAllowSocks5()
Returns:
true if usage of SOCKS5 is allowed