From 3029e571e9e8cd750250f26f4dc6881b382b4988 Mon Sep 17 00:00:00 2001 From: "Jonathan K. Henderson" Date: Sun, 22 Dec 2024 20:56:36 -0500 Subject: [PATCH] improvements to some integration tests (see below for more info) - Renamed some methods in EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodIT to simpler names - Split test classes involving GSS-API and SSL/TLS/DTLS into multiple test classes - Increased jdk.virtualThreadScheduler.parallelism to 2000 - Added system property jdk.virtualThreadScheduler.maxPoolSize set at 3000 --- jargyle-test-echo-server-performance/pom.xml | 3 +- jargyle-test-echo/pom.xml | 5 + ...oSocksServerUsingSocks5GssapiMethodIT.java | 29 + ...oSocksServerUsingSocks5GssapiMethodIT.java | 1149 ++--------------- ...gSocks5GssapiMethodNecReferenceImplIT.java | 611 +++++++++ ...lWithSelectiveIntegOrConfProtectionIT.java | 271 ++++ ...dWithSelectiveIntegOrConfProtectionIT.java | 267 ++++ ...ocksServerUsingSocks5UserpassMethodIT.java | 92 +- ...ngSocks5ClientToSocksServerUsingSslIT.java | 1148 +--------------- ...rverUsingSslWithRequestedClientAuthIT.java | 587 +++++++++ ...erverUsingSslWithRequiredClientAuthIT.java | 587 +++++++++ pom.xml | 3 +- 12 files changed, 2566 insertions(+), 2186 deletions(-) create mode 100644 jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java create mode 100644 jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.java create mode 100644 jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.java create mode 100644 jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.java create mode 100644 jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuthIT.java create mode 100644 jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuthIT.java diff --git a/jargyle-test-echo-server-performance/pom.xml b/jargyle-test-echo-server-performance/pom.xml index 96d6525ce..e83221f46 100644 --- a/jargyle-test-echo-server-performance/pom.xml +++ b/jargyle-test-echo-server-performance/pom.xml @@ -66,7 +66,8 @@ false --> - 30 + 2000 + 3000 ${project.build.directory}${file.separator}performance-reports${file.separator} diff --git a/jargyle-test-echo/pom.xml b/jargyle-test-echo/pom.xml index 564e3df3e..a5902fd65 100644 --- a/jargyle-test-echo/pom.xml +++ b/jargyle-test-echo/pom.xml @@ -72,6 +72,11 @@ maven-failsafe-plugin + + + **/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod*IT + + diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java new file mode 100644 index 000000000..dcb45e5e4 --- /dev/null +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java @@ -0,0 +1,29 @@ +package com.github.jh3nd3rs0n.jargyle.test.echo; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import java.io.IOException; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.class, + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.class, + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.class, + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.class +}) +public class AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT { + + @BeforeClass + public static void setUpBeforeClass() throws IOException { + GssEnvironment.setUpBeforeClass(AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.class); + } + + @AfterClass + public static void tearDownAfterClass() throws IOException { + GssEnvironment.tearDownAfterClass(AllEchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.class); + } + +} diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java index 1db8919db..5b8fd6b2d 100644 --- a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT.java @@ -37,12 +37,6 @@ public class EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodIT private static SocksServer socksServerUsingSocks5GssapiMethod; private static int socksServerPortUsingSocks5GssapiMethod; - private static SocksServer socksServerUsingSocks5GssapiMethodNecReferenceImpl; - private static int socksServerPortUsingSocks5GssapiMethodNecReferenceImpl; - private static SocksServer socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection; - private static int socksServerPortUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection; - private static SocksServer socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection; - private static int socksServerPortUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection; @Rule public Timeout globalTimeout = Timeout.builder() @@ -65,69 +59,6 @@ private static SocksServer newSocksServerUsingSocks5GssapiMethod() throws IOExce return socksServer; } - private static SocksServer newSocksServerUsingSocks5GssapiMethodNecReferenceImpl() throws IOException { - SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( - GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( - Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), - GeneralSettingSpecConstants.PORT.newSetting( - Port.valueOf(0)), - Socks5SettingSpecConstants.SOCKS5_METHODS.newSetting( - Methods.of(Method.GSSAPI)), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newSetting( - Boolean.TRUE), - Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( - PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); - socksServer.start(); - socksServerPortUsingSocks5GssapiMethodNecReferenceImpl = socksServer.getPort().intValue(); - return socksServer; - } - - private static SocksServer newSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() throws IOException { - SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( - GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( - Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), - GeneralSettingSpecConstants.PORT.newSetting( - Port.valueOf(0)), - Socks5SettingSpecConstants.SOCKS5_METHODS.newSetting( - Methods.of(Method.GSSAPI)), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newSetting( - ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newSetting( - 1), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newSetting( - Boolean.TRUE), - Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( - PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); - socksServer.start(); - socksServerPortUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection = - socksServer.getPort().intValue(); - return socksServer; - } - - private static SocksServer newSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() throws IOException { - SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( - GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( - Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), - GeneralSettingSpecConstants.PORT.newSetting( - Port.valueOf(0)), - Socks5SettingSpecConstants.SOCKS5_METHODS.newSetting( - Methods.of(Method.GSSAPI)), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newSetting( - Boolean.TRUE), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newSetting( - ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newSetting( - 1), - Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newSetting( - Boolean.TRUE), - Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( - PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); - socksServer.start(); - socksServerPortUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection = - socksServer.getPort().intValue(); - return socksServer; - } - private static SocksClient newSocks5ClientUsingSocks5GssapiMethod( final ProtectionLevels protectionLevels) { Properties properties = Properties.of( @@ -144,67 +75,6 @@ private static SocksClient newSocks5ClientUsingSocks5GssapiMethod( socksServerPortUsingSocks5GssapiMethod) .newSocksClient(properties); } - - private static SocksClient newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - final ProtectionLevels protectionLevels) { - Properties properties = Properties.of( - Socks5PropertySpecConstants.SOCKS5_METHODS.newProperty( - Methods.of(Method.GSSAPI)), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_MECHANISM_OID.newPropertyWithParsedValue( - GssEnvironment.MECHANISM_OID), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SERVICE_NAME.newProperty( - GssEnvironment.SERVICE_NAME), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newProperty( - Boolean.TRUE), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newProperty( - protectionLevels)); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSocks5GssapiMethodNecReferenceImpl) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() { - Properties properties = Properties.of( - Socks5PropertySpecConstants.SOCKS5_METHODS.newProperty( - Methods.of(Method.GSSAPI)), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_MECHANISM_OID.newPropertyWithParsedValue( - GssEnvironment.MECHANISM_OID), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SERVICE_NAME.newProperty( - GssEnvironment.SERVICE_NAME), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newProperty( - ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newProperty( - 1), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newProperty( - Boolean.TRUE)); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() { - Properties properties = Properties.of( - Socks5PropertySpecConstants.SOCKS5_METHODS.newProperty( - Methods.of(Method.GSSAPI)), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_MECHANISM_OID.newPropertyWithParsedValue( - GssEnvironment.MECHANISM_OID), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SERVICE_NAME.newProperty( - GssEnvironment.SERVICE_NAME), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newProperty( - Boolean.TRUE), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newProperty( - ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newProperty( - 1), - Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newProperty( - Boolean.TRUE)); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection) - .newSocksClient(properties); - } @BeforeClass public static void setUpBeforeClass() throws IOException { @@ -217,12 +87,6 @@ public static void setUpBeforeClass() throws IOException { echoServer.start(); echoServerPort = echoServer.getPort(); socksServerUsingSocks5GssapiMethod = newSocksServerUsingSocks5GssapiMethod(); - socksServerUsingSocks5GssapiMethodNecReferenceImpl = - newSocksServerUsingSocks5GssapiMethodNecReferenceImpl(); - socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection = - newSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection(); - socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection = - newSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection(); } @AfterClass @@ -241,18 +105,6 @@ public static void tearDownAfterClass() throws IOException { && !socksServerUsingSocks5GssapiMethod.getState().equals(SocksServer.State.STOPPED)) { socksServerUsingSocks5GssapiMethod.stop(); } - if (socksServerUsingSocks5GssapiMethodNecReferenceImpl != null - && !socksServerUsingSocks5GssapiMethodNecReferenceImpl.getState().equals(SocksServer.State.STOPPED)) { - socksServerUsingSocks5GssapiMethodNecReferenceImpl.stop(); - } - if (socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection != null - && !socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection.getState().equals(SocksServer.State.STOPPED)) { - socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection.stop(); - } - if (socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection != null - && !socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection.getState().equals(SocksServer.State.STOPPED)) { - socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection.stop(); - } ThreadHelper.interruptibleSleepForThreeSeconds(); } @@ -307,805 +159,305 @@ public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5Gssap } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl01() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection01() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl02() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection02() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl03() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection03() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl04() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection04() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl05() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection05() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection01() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection01() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection02() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection02() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection03() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection03() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection04() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection04() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection05() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection05() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection01() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection02() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection03() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection04() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection05() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection01() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection02() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection03() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection04() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection05() throws IOException { + EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5GssapiMethod( ProtectionLevels.of( ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethod( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegProtection05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethod( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } @@ -1131,181 +483,6 @@ public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethod0 assertEquals(string, returningString); } - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( - ProtectionLevels.of( - ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - @Test public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithIntegAndConfProtection01() throws IOException { Server echServer = EchoServerHelper.newEchoServer( @@ -1425,114 +602,4 @@ public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodW assertEquals(string, returningString); } - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() - .newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - } diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.java new file mode 100644 index 000000000..245daf3be --- /dev/null +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.java @@ -0,0 +1,611 @@ +package com.github.jh3nd3rs0n.jargyle.test.echo; + +import com.github.jh3nd3rs0n.jargyle.client.Properties; +import com.github.jh3nd3rs0n.jargyle.client.Scheme; +import com.github.jh3nd3rs0n.jargyle.client.Socks5PropertySpecConstants; +import com.github.jh3nd3rs0n.jargyle.client.SocksClient; +import com.github.jh3nd3rs0n.jargyle.common.net.Host; +import com.github.jh3nd3rs0n.jargyle.common.net.Port; +import com.github.jh3nd3rs0n.jargyle.common.number.PositiveInteger; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.Method; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.Methods; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.gssapimethod.ProtectionLevel; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.gssapimethod.ProtectionLevels; +import com.github.jh3nd3rs0n.jargyle.server.*; +import com.github.jh3nd3rs0n.jargyle.test.help.net.DatagramServer; +import com.github.jh3nd3rs0n.jargyle.test.help.net.Server; +import com.github.jh3nd3rs0n.jargyle.test.help.string.StringConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.thread.ThreadHelper; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.Timeout; + +import java.io.IOException; +import java.net.InetAddress; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT { + + private static DatagramServer echoDatagramServer; + private static int echoDatagramServerPort; + private static Server echoServer; + private static int echoServerPort; + + private static SocksServer socksServerUsingSocks5GssapiMethodNecReferenceImpl; + private static int socksServerPortUsingSocks5GssapiMethodNecReferenceImpl; + + @Rule + public Timeout globalTimeout = Timeout.builder() + .withTimeout(60, TimeUnit.SECONDS) + .withLookingForStuckThread(true) + .build(); + + private static SocksServer newSocksServerUsingSocks5GssapiMethodNecReferenceImpl() throws IOException { + SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( + GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( + Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), + GeneralSettingSpecConstants.PORT.newSetting( + Port.valueOf(0)), + Socks5SettingSpecConstants.SOCKS5_METHODS.newSetting( + Methods.of(Method.GSSAPI)), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newSetting( + Boolean.TRUE), + Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( + PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); + socksServer.start(); + socksServerPortUsingSocks5GssapiMethodNecReferenceImpl = socksServer.getPort().intValue(); + return socksServer; + } + + private static SocksClient newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + final ProtectionLevels protectionLevels) { + Properties properties = Properties.of( + Socks5PropertySpecConstants.SOCKS5_METHODS.newProperty( + Methods.of(Method.GSSAPI)), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_MECHANISM_OID.newPropertyWithParsedValue( + GssEnvironment.MECHANISM_OID), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SERVICE_NAME.newProperty( + GssEnvironment.SERVICE_NAME), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newProperty( + Boolean.TRUE), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newProperty( + protectionLevels)); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSocks5GssapiMethodNecReferenceImpl) + .newSocksClient(properties); + } + + @BeforeClass + public static void setUpBeforeClass() throws IOException { + GssEnvironment.setUpBeforeClass( + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.class); + echoDatagramServer = EchoDatagramServerHelper.newEchoDatagramServer(0); + echoDatagramServer.start(); + echoDatagramServerPort = echoDatagramServer.getPort(); + echoServer = EchoServerHelper.newEchoServer(0); + echoServer.start(); + echoServerPort = echoServer.getPort(); + socksServerUsingSocks5GssapiMethodNecReferenceImpl = + newSocksServerUsingSocks5GssapiMethodNecReferenceImpl(); + } + + @AfterClass + public static void tearDownAfterClass() throws IOException { + GssEnvironment.tearDownAfterClass( + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplIT.class); + if (echoDatagramServer != null + && !echoDatagramServer.getState().equals(DatagramServer.State.STOPPED)) { + echoDatagramServer.stop(); + } + if (echoServer != null + && !echoServer.getState().equals(Server.State.STOPPED)) { + echoServer.stop(); + } + if (socksServerUsingSocks5GssapiMethodNecReferenceImpl != null + && !socksServerUsingSocks5GssapiMethodNecReferenceImpl.getState().equals(SocksServer.State.STOPPED)) { + socksServerUsingSocks5GssapiMethodNecReferenceImpl.stop(); + } + ThreadHelper.interruptibleSleepForThreeSeconds(); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImpl05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of(ProtectionLevel.NONE)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegAndConfProtection05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG_AND_CONF)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithIntegProtection05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImpl( + ProtectionLevels.of( + ProtectionLevel.REQUIRED_INTEG)).newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + +} diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.java new file mode 100644 index 000000000..4d0ed8dcc --- /dev/null +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.java @@ -0,0 +1,271 @@ +package com.github.jh3nd3rs0n.jargyle.test.echo; + +import com.github.jh3nd3rs0n.jargyle.client.Properties; +import com.github.jh3nd3rs0n.jargyle.client.Scheme; +import com.github.jh3nd3rs0n.jargyle.client.Socks5PropertySpecConstants; +import com.github.jh3nd3rs0n.jargyle.client.SocksClient; +import com.github.jh3nd3rs0n.jargyle.common.net.Host; +import com.github.jh3nd3rs0n.jargyle.common.net.Port; +import com.github.jh3nd3rs0n.jargyle.common.number.PositiveInteger; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.Method; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.Methods; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.gssapimethod.ProtectionLevel; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.gssapimethod.ProtectionLevels; +import com.github.jh3nd3rs0n.jargyle.server.*; +import com.github.jh3nd3rs0n.jargyle.test.help.net.DatagramServer; +import com.github.jh3nd3rs0n.jargyle.test.help.net.Server; +import com.github.jh3nd3rs0n.jargyle.test.help.string.StringConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.thread.ThreadHelper; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.Timeout; + +import java.io.IOException; +import java.net.InetAddress; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT { + + private static DatagramServer echoDatagramServer; + private static int echoDatagramServerPort; + private static Server echoServer; + private static int echoServerPort; + + private static SocksServer socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection; + private static int socksServerPortUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection; + + @Rule + public Timeout globalTimeout = Timeout.builder() + .withTimeout(60, TimeUnit.SECONDS) + .withLookingForStuckThread(true) + .build(); + + private static SocksServer newSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() throws IOException { + SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( + GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( + Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), + GeneralSettingSpecConstants.PORT.newSetting( + Port.valueOf(0)), + Socks5SettingSpecConstants.SOCKS5_METHODS.newSetting( + Methods.of(Method.GSSAPI)), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newSetting( + Boolean.TRUE), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newSetting( + ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newSetting( + 1), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newSetting( + Boolean.TRUE), + Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( + PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); + socksServer.start(); + socksServerPortUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection = + socksServer.getPort().intValue(); + return socksServer; + } + + private static SocksClient newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() { + Properties properties = Properties.of( + Socks5PropertySpecConstants.SOCKS5_METHODS.newProperty( + Methods.of(Method.GSSAPI)), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_MECHANISM_OID.newPropertyWithParsedValue( + GssEnvironment.MECHANISM_OID), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SERVICE_NAME.newProperty( + GssEnvironment.SERVICE_NAME), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_NEC_REFERENCE_IMPL.newProperty( + Boolean.TRUE), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newProperty( + ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newProperty( + 1), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newProperty( + Boolean.TRUE)); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection) + .newSocksClient(properties); + } + + @BeforeClass + public static void setUpBeforeClass() throws IOException { + GssEnvironment.setUpBeforeClass( + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.class); + echoDatagramServer = EchoDatagramServerHelper.newEchoDatagramServer(0); + echoDatagramServer.start(); + echoDatagramServerPort = echoDatagramServer.getPort(); + echoServer = EchoServerHelper.newEchoServer(0); + echoServer.start(); + echoServerPort = echoServer.getPort(); + socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection = + newSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection(); + } + + @AfterClass + public static void tearDownAfterClass() throws IOException { + GssEnvironment.tearDownAfterClass( + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtectionIT.class); + if (echoDatagramServer != null + && !echoDatagramServer.getState().equals(DatagramServer.State.STOPPED)) { + echoDatagramServer.stop(); + } + if (echoServer != null + && !echoServer.getState().equals(Server.State.STOPPED)) { + echoServer.stop(); + } + if (socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection != null + && !socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection.getState().equals(SocksServer.State.STOPPED)) { + socksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection.stop(); + } + ThreadHelper.interruptibleSleepForThreeSeconds(); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodNecReferenceImplWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + +} diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.java new file mode 100644 index 000000000..2ce44511e --- /dev/null +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.java @@ -0,0 +1,267 @@ +package com.github.jh3nd3rs0n.jargyle.test.echo; + +import com.github.jh3nd3rs0n.jargyle.client.Properties; +import com.github.jh3nd3rs0n.jargyle.client.Scheme; +import com.github.jh3nd3rs0n.jargyle.client.Socks5PropertySpecConstants; +import com.github.jh3nd3rs0n.jargyle.client.SocksClient; +import com.github.jh3nd3rs0n.jargyle.common.net.Host; +import com.github.jh3nd3rs0n.jargyle.common.net.Port; +import com.github.jh3nd3rs0n.jargyle.common.number.PositiveInteger; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.Method; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.Methods; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.gssapimethod.ProtectionLevel; +import com.github.jh3nd3rs0n.jargyle.protocolbase.socks5.gssapimethod.ProtectionLevels; +import com.github.jh3nd3rs0n.jargyle.server.*; +import com.github.jh3nd3rs0n.jargyle.test.help.net.DatagramServer; +import com.github.jh3nd3rs0n.jargyle.test.help.net.Server; +import com.github.jh3nd3rs0n.jargyle.test.help.string.StringConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.thread.ThreadHelper; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.Timeout; + +import java.io.IOException; +import java.net.InetAddress; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT { + + private static DatagramServer echoDatagramServer; + private static int echoDatagramServerPort; + private static Server echoServer; + private static int echoServerPort; + + private static SocksServer socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection; + private static int socksServerPortUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection; + + @Rule + public Timeout globalTimeout = Timeout.builder() + .withTimeout(60, TimeUnit.SECONDS) + .withLookingForStuckThread(true) + .build(); + + private static SocksServer newSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() throws IOException { + SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( + GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( + Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), + GeneralSettingSpecConstants.PORT.newSetting( + Port.valueOf(0)), + Socks5SettingSpecConstants.SOCKS5_METHODS.newSetting( + Methods.of(Method.GSSAPI)), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newSetting( + ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newSetting( + 1), + Socks5SettingSpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newSetting( + Boolean.TRUE), + Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( + PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); + socksServer.start(); + socksServerPortUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection = + socksServer.getPort().intValue(); + return socksServer; + } + + private static SocksClient newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() { + Properties properties = Properties.of( + Socks5PropertySpecConstants.SOCKS5_METHODS.newProperty( + Methods.of(Method.GSSAPI)), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_MECHANISM_OID.newPropertyWithParsedValue( + GssEnvironment.MECHANISM_OID), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SERVICE_NAME.newProperty( + GssEnvironment.SERVICE_NAME), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_PROTECTION_LEVELS.newProperty( + ProtectionLevels.of(ProtectionLevel.SELECTIVE_INTEG_OR_CONF)), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_INTEG.newProperty( + 1), + Socks5PropertySpecConstants.SOCKS5_GSSAPIMETHOD_SUGGESTED_CONF.newProperty( + Boolean.TRUE)); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection) + .newSocksClient(properties); + } + + @BeforeClass + public static void setUpBeforeClass() throws IOException { + GssEnvironment.setUpBeforeClass( + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.class); + echoDatagramServer = EchoDatagramServerHelper.newEchoDatagramServer(0); + echoDatagramServer.start(); + echoDatagramServerPort = echoDatagramServer.getPort(); + echoServer = EchoServerHelper.newEchoServer(0); + echoServer.start(); + echoServerPort = echoServer.getPort(); + socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection = + newSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection(); + } + + @AfterClass + public static void tearDownAfterClass() throws IOException { + GssEnvironment.tearDownAfterClass( + EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtectionIT.class); + if (echoDatagramServer != null + && !echoDatagramServer.getState().equals(DatagramServer.State.STOPPED)) { + echoDatagramServer.stop(); + } + if (echoServer != null + && !echoServer.getState().equals(Server.State.STOPPED)) { + echoServer.stop(); + } + if (socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection != null + && !socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection.getState().equals(SocksServer.State.STOPPED)) { + socksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection.stop(); + } + ThreadHelper.interruptibleSleepForThreeSeconds(); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSocks5GssapiMethodWithSelectiveIntegOrConfProtection() + .newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + +} diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodIT.java index 677d37764..1a80293b2 100644 --- a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodIT.java +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodIT.java @@ -84,7 +84,7 @@ private static SocksClient newSocks5ClientUsingSocks5UserpassMethod( .newSocksClient(properties); } - private static SocksClient newSocks5ClientUsingNoSocks5UserpassMethod( + private static SocksClient newSocks5ClientUsingSocks5UserpassMethodImplicitly( final String username, final char[] password) { String usrname; @@ -136,7 +136,7 @@ public static void tearDownAfterClass() throws IOException { } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod01() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod01() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( newSocks5ClientUsingSocks5UserpassMethod( "Aladdin", @@ -147,7 +147,7 @@ public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod02() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod02() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( newSocks5ClientUsingSocks5UserpassMethod( "Jasmine", @@ -158,7 +158,7 @@ public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod03() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod03() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( newSocks5ClientUsingSocks5UserpassMethod( "Abu", @@ -169,7 +169,7 @@ public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod04() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod04() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( newSocks5ClientUsingSocks5UserpassMethod( "Jafar", @@ -180,7 +180,7 @@ public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod05() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod05() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( newSocks5ClientUsingSocks5UserpassMethod( "Jafar", @@ -191,7 +191,7 @@ public void testEchoDatagramClientUsingSocks5ClientUsingSocks5UserpassMethodToSo } @Test - public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod01() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod01() throws IOException { Server echServer = EchoServerHelper.newEchoServer( newSocks5ClientUsingSocks5UserpassMethod( "Aladdin", @@ -203,7 +203,7 @@ public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod02() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod02() throws IOException { Server echServer = EchoServerHelper.newEchoServer( newSocks5ClientUsingSocks5UserpassMethod( "Jasmine", @@ -215,7 +215,7 @@ public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod03() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod03() throws IOException { Server echServer = EchoServerHelper.newEchoServer( newSocks5ClientUsingSocks5UserpassMethod( "Abu", @@ -227,7 +227,7 @@ public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod04() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod04() throws IOException { Server echServer = EchoServerHelper.newEchoServer( newSocks5ClientUsingSocks5UserpassMethod( "Jafar", @@ -239,7 +239,7 @@ public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod05() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod05() throws IOException { Server echServer = EchoServerHelper.newEchoServer( newSocks5ClientUsingSocks5UserpassMethod( "Jafar", @@ -251,7 +251,7 @@ public void testEchoServerUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod01() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod01() throws IOException { EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5UserpassMethod( "Aladdin", @@ -262,7 +262,7 @@ public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod02() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod02() throws IOException { EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5UserpassMethod( "Jasmine", @@ -273,7 +273,7 @@ public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod03() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod03() throws IOException { EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5UserpassMethod( "Abu", @@ -284,7 +284,7 @@ public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod04() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod04() throws IOException { EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5UserpassMethod( "Jafar", @@ -295,7 +295,7 @@ public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod05() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethod05() throws IOException { EchoClient echoClient = new EchoClient( newSocks5ClientUsingSocks5UserpassMethod( "Jafar", @@ -306,9 +306,9 @@ public void testEchoClientUsingSocks5ClientUsingSocks5UserpassMethodToSocksServe } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod01() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly01() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Aladdin", "opensesame".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; @@ -317,9 +317,9 @@ public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodTo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod02() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly02() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jasmine", "mission:impossible".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; @@ -328,9 +328,9 @@ public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodTo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod03() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly03() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Abu", "safeDriversSave40%".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; @@ -339,9 +339,9 @@ public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodTo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod04() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly04() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jafar", "opensesame".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; @@ -350,9 +350,9 @@ public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodTo } @Test - public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod05() throws IOException { + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly05() throws IOException { EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jafar", "opensesame".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; @@ -361,9 +361,9 @@ public void testEchoDatagramClientUsingSocks5ClientUsingNoSocks5UserpassMethodTo } @Test - public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod01() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly01() throws IOException { Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Aladdin", "opensesame".toCharArray()).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_01; @@ -373,9 +373,9 @@ public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod02() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly02() throws IOException { Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jasmine", "mission:impossible".toCharArray()).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_02; @@ -385,9 +385,9 @@ public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod03() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly03() throws IOException { Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Abu", "safeDriversSave40%".toCharArray()).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_03; @@ -397,9 +397,9 @@ public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod04() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly04() throws IOException { Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jafar", "opensesame".toCharArray()).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_04; @@ -409,9 +409,9 @@ public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod05() throws IOException { + public void testEchoServerUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly05() throws IOException { Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jafar", "opensesame".toCharArray()).newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_05; @@ -421,9 +421,9 @@ public void testEchoServerUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod01() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly01() throws IOException { EchoClient echoClient = new EchoClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Aladdin", "opensesame".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_01; @@ -432,9 +432,9 @@ public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod02() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly02() throws IOException { EchoClient echoClient = new EchoClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jasmine", "mission:impossible".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_02; @@ -443,9 +443,9 @@ public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod03() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly03() throws IOException { EchoClient echoClient = new EchoClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Abu", "safeDriversSave40%".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_03; @@ -454,9 +454,9 @@ public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod04() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly04() throws IOException { EchoClient echoClient = new EchoClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jafar", "opensesame".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_04; @@ -465,9 +465,9 @@ public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksSer } @Test - public void testEchoClientUsingSocks5ClientUsingNoSocks5UserpassMethodToSocksServerUsingSocks5UserpassMethod05() throws IOException { + public void testEchoClientUsingSocks5ClientToSocksServerUsingSocks5UserpassMethodImplicitly05() throws IOException { EchoClient echoClient = new EchoClient( - newSocks5ClientUsingNoSocks5UserpassMethod( + newSocks5ClientUsingSocks5UserpassMethodImplicitly( "Jafar", "opensesame".toCharArray()).newSocksNetObjectFactory()); String string = StringConstants.STRING_05; diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslIT.java index c258d2064..6ec83f3ba 100644 --- a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslIT.java +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslIT.java @@ -31,10 +31,6 @@ public class EchoObjectsUsingSocks5ClientToSocksServerUsingSslIT { private static SocksServer socksServerUsingSsl; private static int socksServerPortUsingSsl; - private static SocksServer socksServerUsingSslWithRequestedClientAuth; - private static int socksServerPortUsingSslWithRequestedClientAuth; - private static SocksServer socksServerUsingSslWithRequiredClientAuth; - private static int socksServerPortUsingSslWithRequiredClientAuth; @Rule public Timeout globalTimeout = Timeout.builder() @@ -64,64 +60,6 @@ private static SocksServer newSocksServerUsingSsl() throws IOException { socksServerPortUsingSsl = socksServer.getPort().intValue(); return socksServer; } - - private static SocksServer newSocksServerUsingSslWithRequestedClientAuth() throws IOException { - SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( - GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( - Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), - GeneralSettingSpecConstants.PORT.newSetting( - Port.valueOf(0)), - DtlsSettingSpecConstants.DTLS_ENABLED.newSetting(Boolean.TRUE), - DtlsSettingSpecConstants.DTLS_KEY_STORE_INPUT_STREAM.newSetting( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsSettingSpecConstants.DTLS_KEY_STORE_PASSWORD.newSettingWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslSettingSpecConstants.SSL_ENABLED.newSetting(Boolean.TRUE), - SslSettingSpecConstants.SSL_KEY_STORE_INPUT_STREAM.newSetting( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslSettingSpecConstants.SSL_KEY_STORE_PASSWORD.newSettingWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslSettingSpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newSetting( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), - SslSettingSpecConstants.SSL_TRUST_STORE_PASSWORD.newSettingWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), - SslSettingSpecConstants.SSL_WANT_CLIENT_AUTH.newSetting( - Boolean.TRUE), - Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( - PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); - socksServer.start(); - socksServerPortUsingSslWithRequestedClientAuth = socksServer.getPort().intValue(); - return socksServer; - } - - private static SocksServer newSocksServerUsingSslWithRequiredClientAuth() throws IOException { - SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( - GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( - Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), - GeneralSettingSpecConstants.PORT.newSetting( - Port.valueOf(0)), - DtlsSettingSpecConstants.DTLS_ENABLED.newSetting(Boolean.TRUE), - DtlsSettingSpecConstants.DTLS_KEY_STORE_INPUT_STREAM.newSetting( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsSettingSpecConstants.DTLS_KEY_STORE_PASSWORD.newSettingWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslSettingSpecConstants.SSL_ENABLED.newSetting(Boolean.TRUE), - SslSettingSpecConstants.SSL_KEY_STORE_INPUT_STREAM.newSetting( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslSettingSpecConstants.SSL_KEY_STORE_PASSWORD.newSettingWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslSettingSpecConstants.SSL_NEED_CLIENT_AUTH.newSetting( - Boolean.TRUE), - SslSettingSpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newSetting( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), - SslSettingSpecConstants.SSL_TRUST_STORE_PASSWORD.newSettingWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), - Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( - PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); - socksServer.start(); - socksServerPortUsingSslWithRequiredClientAuth = socksServer.getPort().intValue(); - return socksServer; - } private static SocksClient newSocks5ClientUsingSsl() { Properties properties = Properties.of( @@ -143,138 +81,6 @@ private static SocksClient newSocks5ClientUsingSsl() { .newSocksClient(properties); } - private static SocksClient newSocks5ClientUsingSslWithDifferentRequestedClientAuth() { - Properties properties = Properties.of( - DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( - Boolean.TRUE), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), - SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSslWithRequestedClientAuth) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSslWithDifferentRequiredClientAuth() { - Properties properties = Properties.of( - DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( - Boolean.TRUE), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), - SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSslWithRequiredClientAuth) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSslWithNoRequestedClientAuth() { - Properties properties = Properties.of( - DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( - Boolean.TRUE), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_ENABLED.newProperty( - Boolean.TRUE), - SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSslWithRequestedClientAuth) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSslWithNoRequiredClientAuth() { - Properties properties = Properties.of( - DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( - Boolean.TRUE), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_ENABLED.newProperty( - Boolean.TRUE), - SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSslWithRequiredClientAuth) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSslWithRequestedClientAuth() { - Properties properties = Properties.of( - DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( - Boolean.TRUE), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), - SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), - SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), - SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSslWithRequestedClientAuth) - .newSocksClient(properties); - } - - private static SocksClient newSocks5ClientUsingSslWithRequiredClientAuth() { - Properties properties = Properties.of( - DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( - Boolean.TRUE), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), - SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), - SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), - SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), - SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), - SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( - KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); - return Scheme.SOCKS5.newSocksServerUri( - InetAddress.getLoopbackAddress().getHostAddress(), - socksServerPortUsingSslWithRequiredClientAuth) - .newSocksClient(properties); - } - @BeforeClass public static void setUpBeforeClass() throws IOException { // System.setProperty("javax.net.debug", "ssl,handshake"); @@ -285,10 +91,6 @@ public static void setUpBeforeClass() throws IOException { echoServer.start(); echoServerPort = echoServer.getPort(); socksServerUsingSsl = newSocksServerUsingSsl(); - socksServerUsingSslWithRequestedClientAuth = - newSocksServerUsingSslWithRequestedClientAuth(); - socksServerUsingSslWithRequiredClientAuth = - newSocksServerUsingSslWithRequiredClientAuth(); } @AfterClass @@ -306,14 +108,6 @@ public static void tearDownAfterClass() throws IOException { && !socksServerUsingSsl.getState().equals(SocksServer.State.STOPPED)) { socksServerUsingSsl.stop(); } - if (socksServerUsingSslWithRequestedClientAuth != null - && !socksServerUsingSslWithRequestedClientAuth.getState().equals(SocksServer.State.STOPPED)) { - socksServerUsingSslWithRequestedClientAuth.stop(); - } - if (socksServerUsingSslWithRequiredClientAuth != null - && !socksServerUsingSslWithRequiredClientAuth.getState().equals(SocksServer.State.STOPPED)) { - socksServerUsingSslWithRequiredClientAuth.stop(); - } ThreadHelper.interruptibleSleepForThreeSeconds(); } @@ -362,628 +156,88 @@ public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSsl05() thr assertEquals(string, returningString); } - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSsl().newSocksNetObjectFactory()); String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSsl().newSocksNetObjectFactory()); String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSsl().newSocksNetObjectFactory()); String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); } - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSsl().newSocksNetObjectFactory()); String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSsl().newSocksNetObjectFactory()); String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = echoClient.echo(string, echoServerPort); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } - + @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } - + @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth01() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth02() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth03() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth04() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth05() throws IOException { - EchoDatagramClient echoDatagramClient = new EchoDatagramClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSsl().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSsl().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSsl().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSsl().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSsl05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSsl().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth01() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_01; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth02() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_02; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth03() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_03; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth04() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_04; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth05() throws IOException { - EchoClient echoClient = new EchoClient( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); - String string = StringConstants.STRING_05; - String returningString = echoClient.echo(string, echoServerPort); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSsl().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); assertEquals(string, returningString); } @@ -997,304 +251,4 @@ public void testEchoServerUsingSocks5ClientToSocksServerUsingSsl05() throws IOEx assertEquals(string, returningString); } - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test(expected = IOException.class) - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth01() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_01; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth02() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_02; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth03() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_03; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth04() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_04; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - - @Test - public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth05() throws IOException { - Server echServer = EchoServerHelper.newEchoServer( - newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); - String string = StringConstants.STRING_05; - String returningString = EchoServerHelper.startThenEchoThenStop( - echServer, new EchoClient(), string); - assertEquals(string, returningString); - } - } diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuthIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuthIT.java new file mode 100644 index 000000000..c96ff38af --- /dev/null +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuthIT.java @@ -0,0 +1,587 @@ +package com.github.jh3nd3rs0n.jargyle.test.echo; + +import com.github.jh3nd3rs0n.jargyle.client.*; +import com.github.jh3nd3rs0n.jargyle.common.net.Host; +import com.github.jh3nd3rs0n.jargyle.common.net.Port; +import com.github.jh3nd3rs0n.jargyle.common.number.PositiveInteger; +import com.github.jh3nd3rs0n.jargyle.server.*; +import com.github.jh3nd3rs0n.jargyle.test.help.net.DatagramServer; +import com.github.jh3nd3rs0n.jargyle.test.help.net.Server; +import com.github.jh3nd3rs0n.jargyle.test.help.security.KeyStoreResourceConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.string.StringConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.thread.ThreadHelper; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.Timeout; + +import java.io.IOException; +import java.net.InetAddress; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuthIT { + + private static DatagramServer echoDatagramServer; + private static int echoDatagramServerPort; + private static Server echoServer; + private static int echoServerPort; + + private static SocksServer socksServerUsingSslWithRequestedClientAuth; + private static int socksServerPortUsingSslWithRequestedClientAuth; + + @Rule + public Timeout globalTimeout = Timeout.builder() + .withTimeout(60, TimeUnit.SECONDS) + .withLookingForStuckThread(true) + .build(); + + private static SocksServer newSocksServerUsingSslWithRequestedClientAuth() throws IOException { + SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( + GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( + Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), + GeneralSettingSpecConstants.PORT.newSetting( + Port.valueOf(0)), + DtlsSettingSpecConstants.DTLS_ENABLED.newSetting(Boolean.TRUE), + DtlsSettingSpecConstants.DTLS_KEY_STORE_INPUT_STREAM.newSetting( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsSettingSpecConstants.DTLS_KEY_STORE_PASSWORD.newSettingWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslSettingSpecConstants.SSL_ENABLED.newSetting(Boolean.TRUE), + SslSettingSpecConstants.SSL_KEY_STORE_INPUT_STREAM.newSetting( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslSettingSpecConstants.SSL_KEY_STORE_PASSWORD.newSettingWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslSettingSpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newSetting( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), + SslSettingSpecConstants.SSL_TRUST_STORE_PASSWORD.newSettingWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), + SslSettingSpecConstants.SSL_WANT_CLIENT_AUTH.newSetting( + Boolean.TRUE), + Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( + PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); + socksServer.start(); + socksServerPortUsingSslWithRequestedClientAuth = socksServer.getPort().intValue(); + return socksServer; + } + + private static SocksClient newSocks5ClientUsingSslWithDifferentRequestedClientAuth() { + Properties properties = Properties.of( + DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( + Boolean.TRUE), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), + SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSslWithRequestedClientAuth) + .newSocksClient(properties); + } + + private static SocksClient newSocks5ClientUsingSslWithNoRequestedClientAuth() { + Properties properties = Properties.of( + DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( + Boolean.TRUE), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_ENABLED.newProperty( + Boolean.TRUE), + SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSslWithRequestedClientAuth) + .newSocksClient(properties); + } + + private static SocksClient newSocks5ClientUsingSslWithRequestedClientAuth() { + Properties properties = Properties.of( + DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( + Boolean.TRUE), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), + SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), + SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), + SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSslWithRequestedClientAuth) + .newSocksClient(properties); + } + + @BeforeClass + public static void setUpBeforeClass() throws IOException { + // System.setProperty("javax.net.debug", "ssl,handshake"); + echoDatagramServer = EchoDatagramServerHelper.newEchoDatagramServer(0); + echoDatagramServer.start(); + echoDatagramServerPort = echoDatagramServer.getPort(); + echoServer = EchoServerHelper.newEchoServer(0); + echoServer.start(); + echoServerPort = echoServer.getPort(); + socksServerUsingSslWithRequestedClientAuth = + newSocksServerUsingSslWithRequestedClientAuth(); + } + + @AfterClass + public static void tearDownAfterClass() throws IOException { + // System.clearProperty("javax.net.debug"); + if (echoDatagramServer != null + && !echoDatagramServer.getState().equals(DatagramServer.State.STOPPED)) { + echoDatagramServer.stop(); + } + if (echoServer != null + && !echoServer.getState().equals(Server.State.STOPPED)) { + echoServer.stop(); + } + if (socksServerUsingSslWithRequestedClientAuth != null + && !socksServerUsingSslWithRequestedClientAuth.getState().equals(SocksServer.State.STOPPED)) { + socksServerUsingSslWithRequestedClientAuth.stop(); + } + ThreadHelper.interruptibleSleepForThreeSeconds(); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequestedClientAuth05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequestedClientAuth05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequestedClientAuth05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequestedClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + +} diff --git a/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuthIT.java b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuthIT.java new file mode 100644 index 000000000..04c781ace --- /dev/null +++ b/jargyle-test-echo/src/test/java/com/github/jh3nd3rs0n/jargyle/test/echo/EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuthIT.java @@ -0,0 +1,587 @@ +package com.github.jh3nd3rs0n.jargyle.test.echo; + +import com.github.jh3nd3rs0n.jargyle.client.*; +import com.github.jh3nd3rs0n.jargyle.common.net.Host; +import com.github.jh3nd3rs0n.jargyle.common.net.Port; +import com.github.jh3nd3rs0n.jargyle.common.number.PositiveInteger; +import com.github.jh3nd3rs0n.jargyle.server.*; +import com.github.jh3nd3rs0n.jargyle.test.help.net.DatagramServer; +import com.github.jh3nd3rs0n.jargyle.test.help.net.Server; +import com.github.jh3nd3rs0n.jargyle.test.help.security.KeyStoreResourceConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.string.StringConstants; +import com.github.jh3nd3rs0n.jargyle.test.help.thread.ThreadHelper; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.Timeout; + +import java.io.IOException; +import java.net.InetAddress; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class EchoObjectsUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuthIT { + + private static DatagramServer echoDatagramServer; + private static int echoDatagramServerPort; + private static Server echoServer; + private static int echoServerPort; + + private static SocksServer socksServerUsingSslWithRequiredClientAuth; + private static int socksServerPortUsingSslWithRequiredClientAuth; + + @Rule + public Timeout globalTimeout = Timeout.builder() + .withTimeout(60, TimeUnit.SECONDS) + .withLookingForStuckThread(true) + .build(); + + private static SocksServer newSocksServerUsingSslWithRequiredClientAuth() throws IOException { + SocksServer socksServer = new SocksServer(Configuration.newUnmodifiableInstance(Settings.of( + GeneralSettingSpecConstants.INTERNAL_FACING_BIND_HOST.newSetting( + Host.newInstance(InetAddress.getLoopbackAddress().getHostAddress())), + GeneralSettingSpecConstants.PORT.newSetting( + Port.valueOf(0)), + DtlsSettingSpecConstants.DTLS_ENABLED.newSetting(Boolean.TRUE), + DtlsSettingSpecConstants.DTLS_KEY_STORE_INPUT_STREAM.newSetting( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsSettingSpecConstants.DTLS_KEY_STORE_PASSWORD.newSettingWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslSettingSpecConstants.SSL_ENABLED.newSetting(Boolean.TRUE), + SslSettingSpecConstants.SSL_KEY_STORE_INPUT_STREAM.newSetting( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslSettingSpecConstants.SSL_KEY_STORE_PASSWORD.newSettingWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslSettingSpecConstants.SSL_NEED_CLIENT_AUTH.newSetting( + Boolean.TRUE), + SslSettingSpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newSetting( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), + SslSettingSpecConstants.SSL_TRUST_STORE_PASSWORD.newSettingWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), + Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_REQUEST_RELAY_BUFFER_SIZE.newSetting( + PositiveInteger.valueOf(DatagramServer.RECEIVE_BUFFER_SIZE))))); + socksServer.start(); + socksServerPortUsingSslWithRequiredClientAuth = socksServer.getPort().intValue(); + return socksServer; + } + + private static SocksClient newSocks5ClientUsingSslWithDifferentRequiredClientAuth() { + Properties properties = Properties.of( + DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( + Boolean.TRUE), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), + SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSslWithRequiredClientAuth) + .newSocksClient(properties); + } + + private static SocksClient newSocks5ClientUsingSslWithNoRequiredClientAuth() { + Properties properties = Properties.of( + DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( + Boolean.TRUE), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_ENABLED.newProperty( + Boolean.TRUE), + SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSslWithRequiredClientAuth) + .newSocksClient(properties); + } + + private static SocksClient newSocks5ClientUsingSslWithRequiredClientAuth() { + Properties properties = Properties.of( + DtlsPropertySpecConstants.DTLS_ENABLED.newProperty( + Boolean.TRUE), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + DtlsPropertySpecConstants.DTLS_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString()), + SslPropertySpecConstants.SSL_ENABLED.newProperty(Boolean.TRUE), + SslPropertySpecConstants.SSL_KEY_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_2.getInputStream()), + SslPropertySpecConstants.SSL_KEY_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_2.getContentAsString()), + SslPropertySpecConstants.SSL_TRUST_STORE_INPUT_STREAM.newProperty( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_FILE_1.getInputStream()), + SslPropertySpecConstants.SSL_TRUST_STORE_PASSWORD.newPropertyWithParsedValue( + KeyStoreResourceConstants.JARGYLE_TEST_HELP_SECURITY_KEY_STORE_PASSWORD_FILE_1.getContentAsString())); + return Scheme.SOCKS5.newSocksServerUri( + InetAddress.getLoopbackAddress().getHostAddress(), + socksServerPortUsingSslWithRequiredClientAuth) + .newSocksClient(properties); + } + + @BeforeClass + public static void setUpBeforeClass() throws IOException { + // System.setProperty("javax.net.debug", "ssl,handshake"); + echoDatagramServer = EchoDatagramServerHelper.newEchoDatagramServer(0); + echoDatagramServer.start(); + echoDatagramServerPort = echoDatagramServer.getPort(); + echoServer = EchoServerHelper.newEchoServer(0); + echoServer.start(); + echoServerPort = echoServer.getPort(); + socksServerUsingSslWithRequiredClientAuth = + newSocksServerUsingSslWithRequiredClientAuth(); + } + + @AfterClass + public static void tearDownAfterClass() throws IOException { + // System.clearProperty("javax.net.debug"); + if (echoDatagramServer != null + && !echoDatagramServer.getState().equals(DatagramServer.State.STOPPED)) { + echoDatagramServer.stop(); + } + if (echoServer != null + && !echoServer.getState().equals(Server.State.STOPPED)) { + echoServer.stop(); + } + if (socksServerUsingSslWithRequiredClientAuth != null + && !socksServerUsingSslWithRequiredClientAuth.getState().equals(SocksServer.State.STOPPED)) { + socksServerUsingSslWithRequiredClientAuth.stop(); + } + ThreadHelper.interruptibleSleepForThreeSeconds(); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth01() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth02() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth03() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth04() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoDatagramClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth05() throws IOException { + EchoDatagramClient echoDatagramClient = new EchoDatagramClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoDatagramClient.echo(string, echoDatagramServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth01() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_01; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth02() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_02; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth03() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_03; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth04() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_04; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test + public void testEchoClientUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth05() throws IOException { + EchoClient echoClient = new EchoClient( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory()); + String string = StringConstants.STRING_05; + String returningString = echoClient.echo(string, echoServerPort); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithDifferentRequiredClientAuth05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithDifferentRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test(expected = IOException.class) + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithNoRequiredClientAuth05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithNoRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth01() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_01; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth02() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_02; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth03() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_03; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth04() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_04; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + + @Test + public void testEchoServerUsingSocks5ClientToSocksServerUsingSslWithRequiredClientAuth05() throws IOException { + Server echServer = EchoServerHelper.newEchoServer( + newSocks5ClientUsingSslWithRequiredClientAuth().newSocksNetObjectFactory(), 0); + String string = StringConstants.STRING_05; + String returningString = EchoServerHelper.startThenEchoThenStop( + echServer, new EchoClient(), string); + assertEquals(string, returningString); + } + +} diff --git a/pom.xml b/pom.xml index 8288a935a..f001e9499 100644 --- a/pom.xml +++ b/pom.xml @@ -190,7 +190,8 @@ false --> - 30 + 2000 + 3000