org.jivesoftware.smackx.bytestreams.socks5
Class Socks5ProxyTest

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

public class Socks5ProxyTest
extends java.lang.Object

Test for Socks5Proxy class.

Author:
Henning Staib

Constructor Summary
Socks5ProxyTest()
           
 
Method Summary
 void cleanup()
          Reset SOCKS5 proxy settings.
 void shouldBeASingleton()
          The SOCKS5 proxy should be a singleton used by all XMPP connections
 void shouldCloseSocketIfNoSocks5Request()
          If the SOCKS5 proxy accepts a connection that is not a SOCKS5 connection it should close the corresponding socket.
 void shouldNotBeRunningIfDisabled()
          The SOCKS5 proxy should not be started if disabled by configuration.
 void shouldNotReturnMultipleSameAddress()
          Inserting the same address multiple times should not cause the proxy to return this address multiple times.
 void shouldOnlyStartOneServerThread()
          There should be only one thread executing the SOCKS5 proxy process.
 void shouldPreserveAddressOrderOnInsertions()
          When inserting new network addresses to the proxy the order should remain in the order they were inserted.
 void shouldPreserveAddressOrderOnReplace()
          When replacing network addresses of the proxy the order should remain in the order if the given list.
 void shouldRespondWithErrorIfConnectionIsNotAllowed()
          The SOCKS5 proxy should respond with an error message if the client is not allowed to connect with the proxy.
 void shouldRespondWithErrorIfNoSupportedAuthenticationMethod()
          The SOCKS5 proxy should reply with an error message if no supported authentication methods are given in the SOCKS5 request.
 void shouldSuccessfullyEstablishConnection()
          A Client should successfully establish a connection to the SOCKS5 proxy.
 void shouldUseFreePortOnNegativeValues()
          The SOCKS5 proxy should use a free port above the one configured.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Socks5ProxyTest

public Socks5ProxyTest()
Method Detail

shouldBeASingleton

public void shouldBeASingleton()
The SOCKS5 proxy should be a singleton used by all XMPP connections


shouldNotBeRunningIfDisabled

public void shouldNotBeRunningIfDisabled()
The SOCKS5 proxy should not be started if disabled by configuration.


shouldUseFreePortOnNegativeValues

public void shouldUseFreePortOnNegativeValues()
                                       throws java.lang.Exception
The SOCKS5 proxy should use a free port above the one configured.

Throws:
java.lang.Exception - should not happen

shouldPreserveAddressOrderOnInsertions

public void shouldPreserveAddressOrderOnInsertions()
When inserting new network addresses to the proxy the order should remain in the order they were inserted.


shouldPreserveAddressOrderOnReplace

public void shouldPreserveAddressOrderOnReplace()
When replacing network addresses of the proxy the order should remain in the order if the given list.


shouldNotReturnMultipleSameAddress

public void shouldNotReturnMultipleSameAddress()
Inserting the same address multiple times should not cause the proxy to return this address multiple times.


shouldOnlyStartOneServerThread

public void shouldOnlyStartOneServerThread()
There should be only one thread executing the SOCKS5 proxy process.


shouldCloseSocketIfNoSocks5Request

public void shouldCloseSocketIfNoSocks5Request()
                                        throws java.lang.Exception
If the SOCKS5 proxy accepts a connection that is not a SOCKS5 connection it should close the corresponding socket.

Throws:
java.lang.Exception - should not happen

shouldRespondWithErrorIfNoSupportedAuthenticationMethod

public void shouldRespondWithErrorIfNoSupportedAuthenticationMethod()
                                                             throws java.lang.Exception
The SOCKS5 proxy should reply with an error message if no supported authentication methods are given in the SOCKS5 request.

Throws:
java.lang.Exception - should not happen

shouldRespondWithErrorIfConnectionIsNotAllowed

public void shouldRespondWithErrorIfConnectionIsNotAllowed()
                                                    throws java.lang.Exception
The SOCKS5 proxy should respond with an error message if the client is not allowed to connect with the proxy.

Throws:
java.lang.Exception - should not happen

shouldSuccessfullyEstablishConnection

public void shouldSuccessfullyEstablishConnection()
                                           throws java.lang.Exception
A Client should successfully establish a connection to the SOCKS5 proxy.

Throws:
java.lang.Exception - should not happen

cleanup

public void cleanup()
Reset SOCKS5 proxy settings.