示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSupportOpenSSLOnSupportedPlatforms() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSupportOpenSSLOnSupportedPlatforms()
        {
            // depends on the statically linked uber-jar with boring ssl: http://netty.io/wiki/forked-tomcat-native.html
            assumeTrue(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC_OSX);
            assumeThat(System.getProperty("os.arch"), equalTo("x86_64"));
            assumeThat(SystemUtils.JAVA_VENDOR, isOneOf("Oracle Corporation", "Sun Microsystems Inc."));

            // given
            SslResource sslServerResource = selfSignedKeyId(0).trustKeyId(1).install(TestDir.directory("server"));
            SslResource sslClientResource = selfSignedKeyId(1).trustKeyId(0).install(TestDir.directory("client"));

            _server = new SecureServer(SslContextFactory.MakeSslPolicy(sslServerResource, SslProvider.OPENSSL));

            _server.start();
            _client = new SecureClient(SslContextFactory.MakeSslPolicy(sslClientResource, SslProvider.OPENSSL));
            _client.connect(_server.port());

            // when
            ByteBuf request = ByteBufAllocator.DEFAULT.buffer().writeBytes(_request);

            _client.channel().writeAndFlush(request);

            // then
            _expected = ByteBufAllocator.DEFAULT.buffer().writeBytes(SecureServer.Response);
            _client.sslHandshakeFuture().get(1, MINUTES);
            _client.assertResponse(_expected);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void partiesWithMutualTrustShouldCommunicate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PartiesWithMutualTrustShouldCommunicate()
        {
            // given
            SslResource sslServerResource = selfSignedKeyId(0).trustKeyId(1).install(TestDir.directory("server"));
            SslResource sslClientResource = selfSignedKeyId(1).trustKeyId(0).install(TestDir.directory("client"));

            _server = new SecureServer(SslContextFactory.MakeSslPolicy(sslServerResource));

            _server.start();
            _client = new SecureClient(SslContextFactory.MakeSslPolicy(sslClientResource));
            _client.connect(_server.port());

            // when
            ByteBuf request = ByteBufAllocator.DEFAULT.buffer().writeBytes(_request);

            _client.channel().writeAndFlush(request);

            // then
            _expected = ByteBufAllocator.DEFAULT.buffer().writeBytes(SecureServer.Response);
            _client.sslHandshakeFuture().get(1, MINUTES);
            _client.assertResponse(_expected);
        }