org.jivesoftware.smackx.bytestreams.socks5
Class Socks5ByteStreamManagerTest

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

public class Socks5ByteStreamManagerTest
extends java.lang.Object

Test for Socks5BytestreamManager.

Author:
Henning Staib

Constructor Summary
Socks5ByteStreamManagerTest()
           
 
Method Summary
 void cleanUp()
          Stop eventually started local SOCKS5 test proxy.
 void setup()
          Initialize fields used in the tests.
 void shouldBlacklistNonSocks5Proxies()
          Invoking Socks5BytestreamManager.establishSession(String, String) should fail if no SOCKS5 proxy can be found.
 void shouldDisableService()
          The SOCKS5 Bytestream feature should be removed form the service discovery manager if Socks5 bytestream feature is disabled.
 void shouldFailIfInitiatorCannotConnectToSocks5Proxy()
          Invoking Socks5BytestreamManager.establishSession(String, String) should fail if initiator can not connect to the SOCKS5 proxy used by target.
 void shouldFailIfNoSocks5ProxyFound1()
          Invoking Socks5BytestreamManager.establishSession(String, String) should fail if XMPP server doesn't return any proxies.
 void shouldFailIfNoSocks5ProxyFound2()
          Invoking Socks5BytestreamManager.establishSession(String, String) should fail if no proxy is a SOCKS5 proxy.
 void shouldFailIfTargetDoesNotAcceptSocks5Bytestream()
          Invoking Socks5BytestreamManager.establishSession(String, String) should fail if the target does not accept a SOCKS5 Bytestream.
 void shouldFailIfTargetDoesNotSupportSocks5()
          Invoking Socks5BytestreamManager.establishSession(String) should throw an exception if the given target does not support SOCKS5 Bytestream.
 void shouldFailIfTargetUsesInvalidSocks5Proxy()
          Invoking Socks5BytestreamManager.establishSession(String, String) should fail if the proxy used by target is invalid.
 void shouldHaveOneManagerForEveryConnection()
          Test that Socks5BytestreamManager.getBytestreamManager(Connection) returns one bytestream manager for every connection
 void shouldNegotiateSocks5BytestreamAndTransferData()
          Invoking Socks5BytestreamManager.establishSession(String, String) should successfully negotiate and return a SOCKS5 Bytestream connection.
 void shouldNotPrioritizeSocks5ProxyIfPrioritizationDisabled()
          Invoking Socks5BytestreamManager.establishSession(String, String) the first time should successfully negotiate a SOCKS5 Bytestream via the second SOCKS5 proxy.
 void shouldPrioritizeSecondSocks5ProxyOnSecondAttempt()
          Invoking Socks5BytestreamManager.establishSession(String, String) the first time should successfully negotiate a SOCKS5 Bytestream via the second SOCKS5 proxy and should prioritize this proxy for a second SOCKS5 Bytestream negotiation.
 void shouldUseMultipleAddressesForLocalSocks5Proxy()
          If multiple network addresses are added to the local SOCKS5 proxy, all of them should be contained in the SOCKS5 Bytestream request.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Socks5ByteStreamManagerTest

public Socks5ByteStreamManagerTest()
Method Detail

setup

public void setup()
Initialize fields used in the tests.


shouldHaveOneManagerForEveryConnection

public void shouldHaveOneManagerForEveryConnection()
Test that Socks5BytestreamManager.getBytestreamManager(Connection) returns one bytestream manager for every connection


shouldDisableService

public void shouldDisableService()
The SOCKS5 Bytestream feature should be removed form the service discovery manager if Socks5 bytestream feature is disabled.


shouldFailIfTargetDoesNotSupportSocks5

public void shouldFailIfTargetDoesNotSupportSocks5()
Invoking Socks5BytestreamManager.establishSession(String) should throw an exception if the given target does not support SOCKS5 Bytestream.


shouldFailIfNoSocks5ProxyFound1

public void shouldFailIfNoSocks5ProxyFound1()
Invoking Socks5BytestreamManager.establishSession(String, String) should fail if XMPP server doesn't return any proxies.


shouldFailIfNoSocks5ProxyFound2

public void shouldFailIfNoSocks5ProxyFound2()
Invoking Socks5BytestreamManager.establishSession(String, String) should fail if no proxy is a SOCKS5 proxy.


shouldBlacklistNonSocks5Proxies

public void shouldBlacklistNonSocks5Proxies()
Invoking Socks5BytestreamManager.establishSession(String, String) should fail if no SOCKS5 proxy can be found. If it turns out that a proxy is not a SOCKS5 proxy it should not be queried again.


shouldFailIfTargetDoesNotAcceptSocks5Bytestream

public void shouldFailIfTargetDoesNotAcceptSocks5Bytestream()
Invoking Socks5BytestreamManager.establishSession(String, String) should fail if the target does not accept a SOCKS5 Bytestream. See XEP-0065 Section 5.2 A2


shouldFailIfTargetUsesInvalidSocks5Proxy

public void shouldFailIfTargetUsesInvalidSocks5Proxy()
Invoking Socks5BytestreamManager.establishSession(String, String) should fail if the proxy used by target is invalid.


shouldFailIfInitiatorCannotConnectToSocks5Proxy

public void shouldFailIfInitiatorCannotConnectToSocks5Proxy()
Invoking Socks5BytestreamManager.establishSession(String, String) should fail if initiator can not connect to the SOCKS5 proxy used by target.


shouldNegotiateSocks5BytestreamAndTransferData

public void shouldNegotiateSocks5BytestreamAndTransferData()
                                                    throws java.lang.Exception
Invoking Socks5BytestreamManager.establishSession(String, String) should successfully negotiate and return a SOCKS5 Bytestream connection.

Throws:
java.lang.Exception - should not happen

shouldUseMultipleAddressesForLocalSocks5Proxy

public void shouldUseMultipleAddressesForLocalSocks5Proxy()
                                                   throws java.lang.Exception
If multiple network addresses are added to the local SOCKS5 proxy, all of them should be contained in the SOCKS5 Bytestream request.

Throws:
java.lang.Exception - should not happen

shouldPrioritizeSecondSocks5ProxyOnSecondAttempt

public void shouldPrioritizeSecondSocks5ProxyOnSecondAttempt()
                                                      throws java.lang.Exception
Invoking Socks5BytestreamManager.establishSession(String, String) the first time should successfully negotiate a SOCKS5 Bytestream via the second SOCKS5 proxy and should prioritize this proxy for a second SOCKS5 Bytestream negotiation.

Throws:
java.lang.Exception - should not happen

shouldNotPrioritizeSocks5ProxyIfPrioritizationDisabled

public void shouldNotPrioritizeSocks5ProxyIfPrioritizationDisabled()
                                                            throws java.lang.Exception
Invoking Socks5BytestreamManager.establishSession(String, String) the first time should successfully negotiate a SOCKS5 Bytestream via the second SOCKS5 proxy. The second negotiation should run in the same manner if prioritization is disabled.

Throws:
java.lang.Exception - should not happen

cleanUp

public void cleanUp()
Stop eventually started local SOCKS5 test proxy.