org.jivesoftware.smackx.bytestreams.socks5
Class Socks5TestProxy

java.lang.Object
  extended by org.jivesoftware.smackx.bytestreams.socks5.Socks5TestProxy

public class Socks5TestProxy
extends java.lang.Object

Simple SOCKS5 proxy for testing purposes. It is almost the same as the Socks5Proxy class but the port can be configured more easy and it all connections are allowed.

Author:
Henning Staib

Method Summary
 java.lang.String getAddress()
          Returns the host address of the local SOCKS5 proxy server.
 int getPort()
          Returns the port of the local SOCKS5 proxy server.
static Socks5TestProxy getProxy(int port)
          Returns the local SOCKS5 proxy server
 java.net.Socket getSocket(java.lang.String digest)
          Returns the socket for the given digest.
 boolean isRunning()
          Returns true if the local SOCKS5 proxy server is running, otherwise false.
 void start()
          Starts the local SOCKS5 proxy server.
 void stop()
          Stops the local SOCKS5 proxy server.
static void stopProxy()
          Stops the test proxy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProxy

public static Socks5TestProxy getProxy(int port)
Returns the local SOCKS5 proxy server

Parameters:
port - of the test proxy
Returns:
the local SOCKS5 proxy server

stopProxy

public static void stopProxy()
Stops the test proxy


start

public void start()
Starts the local SOCKS5 proxy server. If it is already running, this method does nothing.


stop

public void stop()
Stops the local SOCKS5 proxy server. If it is not running this method does nothing.


getAddress

public java.lang.String getAddress()
Returns the host address of the local SOCKS5 proxy server.

Returns:
the host address of the local SOCKS5 proxy server

getPort

public int getPort()
Returns the port of the local SOCKS5 proxy server. If it is not running -1 will be returned.

Returns:
the port of the local SOCKS5 proxy server or -1 if proxy is not running

getSocket

public java.net.Socket getSocket(java.lang.String digest)
Returns the socket for the given digest.

Parameters:
digest - identifying the connection
Returns:
socket or null if there is no socket for the given digest

isRunning

public boolean isRunning()
Returns true if the local SOCKS5 proxy server is running, otherwise false.

Returns:
true if the local SOCKS5 proxy server is running, otherwise false