org.jivesoftware.smackx.bytestreams.socks5
Class Socks5ByteStreamRequestTest

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

public class Socks5ByteStreamRequestTest
extends java.lang.Object

Tests for the Socks5BytestreamRequest class.

Author:
Henning Staib

Constructor Summary
Socks5ByteStreamRequestTest()
           
 
Method Summary
 void cleanUp()
          Stop eventually started local SOCKS5 test proxy.
 void setup()
          Initialize fields used in the tests.
 void shouldAcceptSocks5BytestreamRequestAndReceiveData()
          Accepting the SOCKS5 Bytestream request should be successfully.
 void shouldBlacklistInvalidProxyAfter2Failures()
          Target should not try to connect to SOCKS5 proxies that already failed twice.
 void shouldFailIfRequestHasInvalidStreamHosts()
          Accepting a SOCKS5 Bytestream request should fail if target is not able to connect to any of the provided SOCKS5 proxies.
 void shouldFailIfRequestHasNoStreamHosts()
          Accepting a SOCKS5 Bytestream request should fail if the request doesn't contain any Socks5 proxies.
 void shouldNotBlacklistInvalidProxy()
          Target should not not blacklist any SOCKS5 proxies regardless of failing connections.
 void shouldNotTimeoutIfFirstSocks5ProxyDoesNotRespond()
          If the SOCKS5 Bytestream request contains multiple SOCKS5 proxies and the first one doesn't respond, the connection attempt to this proxy should not consume the whole timeout for connecting to the proxies.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Socks5ByteStreamRequestTest

public Socks5ByteStreamRequestTest()
Method Detail

setup

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


shouldFailIfRequestHasNoStreamHosts

public void shouldFailIfRequestHasNoStreamHosts()
                                         throws java.lang.Exception
Accepting a SOCKS5 Bytestream request should fail if the request doesn't contain any Socks5 proxies.

Throws:
java.lang.Exception - should not happen

shouldFailIfRequestHasInvalidStreamHosts

public void shouldFailIfRequestHasInvalidStreamHosts()
                                              throws java.lang.Exception
Accepting a SOCKS5 Bytestream request should fail if target is not able to connect to any of the provided SOCKS5 proxies.

Throws:
java.lang.Exception

shouldBlacklistInvalidProxyAfter2Failures

public void shouldBlacklistInvalidProxyAfter2Failures()
                                               throws java.lang.Exception
Target should not try to connect to SOCKS5 proxies that already failed twice.

Throws:
java.lang.Exception - should not happen

shouldNotBlacklistInvalidProxy

public void shouldNotBlacklistInvalidProxy()
                                    throws java.lang.Exception
Target should not not blacklist any SOCKS5 proxies regardless of failing connections.

Throws:
java.lang.Exception - should not happen

shouldNotTimeoutIfFirstSocks5ProxyDoesNotRespond

public void shouldNotTimeoutIfFirstSocks5ProxyDoesNotRespond()
                                                      throws java.lang.Exception
If the SOCKS5 Bytestream request contains multiple SOCKS5 proxies and the first one doesn't respond, the connection attempt to this proxy should not consume the whole timeout for connecting to the proxies.

Throws:
java.lang.Exception - should not happen

shouldAcceptSocks5BytestreamRequestAndReceiveData

public void shouldAcceptSocks5BytestreamRequestAndReceiveData()
                                                       throws java.lang.Exception
Accepting the SOCKS5 Bytestream request should be successfully.

Throws:
java.lang.Exception - should not happen

cleanUp

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