158159160161162163164165166167168
proxy.start(); assertTrue(proxy.isRunning()); assertEquals(threadCount + 1, Thread.activeCount()); proxy.stop(); assertFalse(proxy.isRunning()); assertEquals(threadCount, Thread.activeCount()); proxy.start();
168169170171172173174175176177178
proxy.start(); assertTrue(proxy.isRunning()); assertEquals(threadCount + 1, Thread.activeCount()); proxy.stop(); } /** * If the SOCKS5 proxy accepts a connection that is not a SOCKS5 connection it should close the
191192193194195196197198199200201
OutputStream out = socket.getOutputStream(); out.write(new byte[] { 1, 2, 3 }); assertEquals(-1, socket.getInputStream().read()); proxy.stop(); } /** * The SOCKS5 proxy should reply with an error message if no supported authentication methods
221222223224225226227228229230231
assertEquals((byte) 0x05, (byte) in.read()); assertEquals((byte) 0xFF, (byte) in.read()); assertEquals(-1, in.read()); proxy.stop(); } /** * The SOCKS5 proxy should respond with an error message if the client is not allowed to connect
263264265266267268269270271272273
assertEquals((byte) 0x00, (byte) in.read()); assertEquals((byte) 0x00, (byte) in.read()); assertEquals(-1, in.read()); proxy.stop(); } /** * A Client should successfully establish a connection to the SOCKS5 proxy.
330331332333334335336337338339340
remoteSocket.close(); assertEquals(-1, in.read()); proxy.stop(); } /** * Reset SOCKS5 proxy settings.
352353354355356357358359360
} catch (UnknownHostException e) { // ignore } socks5Proxy.stop(); } }
193194195196197198199200201202203
StringBuilder sb = new StringBuilder(); if (settingsChanged) sb.append("Socks5Proxy properties changed. "); if (proxy.isRunning()) { proxy.stop(); sb.append("Socks5Proxy stopped. "); } if (proxyEnabled) { proxy.start(); sb.append("Socks5Proxy started on port " + proxy.getPort()
106107108109110111112113114115116
catch (XMPPException e) { assertTrue(e.getMessage().contains("target is not connected to SOCKS5 proxy")); protocol.verifyAll(); // assert no XMPP messages were sent } socks5Proxy.stop(); } /** * Initiator and target should successfully connect to the local SOCKS5 proxy.
174175176177178179180181182183184
targetThread.join(); protocol.verifyAll(); // assert no XMPP messages were sent socks5Proxy.removeTransfer(digest); socks5Proxy.stop(); } /** * If the initiator can connect to a SOCKS5 proxy but activating the stream fails an exception