Home / Function/ testHandshakeWithExecutor() — netty Function Reference

testHandshakeWithExecutor() — netty Function Reference

Architecture documentation for the testHandshakeWithExecutor() function in SslHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  51a85ca8_2fc7_1f36_0008_16fdbd5d3268["testHandshakeWithExecutor()"]
  adaf7dc7_94e2_152f_ffdb_453fdaa4f25e["SslHandlerTest"]
  51a85ca8_2fc7_1f36_0008_16fdbd5d3268 -->|defined in| adaf7dc7_94e2_152f_ffdb_453fdaa4f25e
  909e78d4_4935_63bc_4e67_03a03abba1c4["testHandshakeWithExecutorThatExecuteDirectlyJDK()"]
  909e78d4_4935_63bc_4e67_03a03abba1c4 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  f47ff292_68e7_089c_9d12_5a679aff5d3c["testHandshakeWithImmediateExecutorJDK()"]
  f47ff292_68e7_089c_9d12_5a679aff5d3c -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  06e0faf6_3365_eda1_2d2a_d2aa81bfe9c9["testHandshakeWithImmediateEventExecutorJDK()"]
  06e0faf6_3365_eda1_2d2a_d2aa81bfe9c9 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  a76aefe9_ec73_fe06_eb2d_60b4ae275fe7["testHandshakeWithExecutorJDK()"]
  a76aefe9_ec73_fe06_eb2d_60b4ae275fe7 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  9b3f948e_f162_de28_0472_3844e9c2e7c5["testHandshakeWithExecutorThatExecuteDirectlyOpenSsl()"]
  9b3f948e_f162_de28_0472_3844e9c2e7c5 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  6435cdf9_5cd0_16b8_a192_7c304a7fc1fe["testHandshakeWithImmediateExecutorOpenSsl()"]
  6435cdf9_5cd0_16b8_a192_7c304a7fc1fe -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  2e8c86b0_00de_3af5_574d_355eec08f6bb["testHandshakeWithImmediateEventExecutorOpenSsl()"]
  2e8c86b0_00de_3af5_574d_355eec08f6bb -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  b2a56428_3938_7127_3347_ff054e540cd9["testHandshakeWithExecutorOpenSsl()"]
  b2a56428_3938_7127_3347_ff054e540cd9 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  effa06c4_5007_f4ca_0a5c_374e70e25cb7["testHandshakeMTLSWithExecutorThatExecuteDirectlyJDK()"]
  effa06c4_5007_f4ca_0a5c_374e70e25cb7 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  a07b7705_2b2b_bc70_fe6b_7104f1efa892["testHandshakeMTLSWithImmediateExecutorJDK()"]
  a07b7705_2b2b_bc70_fe6b_7104f1efa892 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  33331083_facc_4eae_35f2_42597cd86be9["testHandshakeMTLSWithImmediateEventExecutorJDK()"]
  33331083_facc_4eae_35f2_42597cd86be9 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  31c2db99_1a64_d692_35f2_264fe2902860["testHandshakeMTLSWithExecutorJDK()"]
  31c2db99_1a64_d692_35f2_264fe2902860 -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  173fc098_4549_8c9a_2dcc_c0897bce87ba["testHandshakeMTLSWithExecutorThatExecuteDirectlyOpenSsl()"]
  173fc098_4549_8c9a_2dcc_c0897bce87ba -->|calls| 51a85ca8_2fc7_1f36_0008_16fdbd5d3268
  style 51a85ca8_2fc7_1f36_0008_16fdbd5d3268 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java lines 1084–1167

    private static void testHandshakeWithExecutor(Executor executor, SslProvider provider, boolean mtls)
            throws Throwable {
        final SelfSignedCertificate cert = CachedSelfSignedCertificate.getCachedCertificate();
        final SslContext sslClientCtx;
        final SslContext sslServerCtx;
        if (mtls) {
            sslClientCtx = SslContextBuilder.forClient().protocols(SslProtocols.TLS_v1_2)
                    .trustManager(InsecureTrustManagerFactory.INSTANCE).keyManager(cert.key(), cert.cert())
                    .sslProvider(provider).build();

            sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert()).protocols(SslProtocols.TLS_v1_2)
                    .trustManager(InsecureTrustManagerFactory.INSTANCE)
                    .clientAuth(ClientAuth.REQUIRE)
                    .sslProvider(provider).build();
        } else {
            sslClientCtx = SslContextBuilder.forClient()
                    .trustManager(InsecureTrustManagerFactory.INSTANCE)
                    .sslProvider(provider).build();

            sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert())
                    .sslProvider(provider).build();
        }

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        Channel sc = null;
        Channel cc = null;
        final SslHandler clientSslHandler = new SslHandler(
                sslClientCtx.newEngine(UnpooledByteBufAllocator.DEFAULT), executor);
        final SslHandler serverSslHandler = new SslHandler(
                sslServerCtx.newEngine(UnpooledByteBufAllocator.DEFAULT), executor);
        final AtomicReference<Throwable> causeRef = new AtomicReference<Throwable>();
        try {
            sc = new ServerBootstrap()
                    .group(group)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            ch.pipeline().addLast(serverSslHandler);
                            ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                                @Override
                                public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
                                    causeRef.compareAndSet(null, cause);
                                }
                            });
                        }
                    })
                    .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();

            ChannelFuture future = new Bootstrap()
                    .group(group)
                    .channel(NioSocketChannel.class)
                    .handler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            ch.pipeline().addLast(clientSslHandler);
                            ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                                @Override
                                public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
                                    causeRef.compareAndSet(null, cause);
                                }
                            });
                        }
                    }).connect(sc.localAddress());
            cc = future.syncUninterruptibly().channel();

            assertTrue(clientSslHandler.handshakeFuture().await().isSuccess());
            assertTrue(serverSslHandler.handshakeFuture().await().isSuccess());
            Throwable cause = causeRef.get();
            if (cause != null) {
                throw cause;
            }
        } finally {
            if (cc != null) {
                cc.close().syncUninterruptibly();
            }
            if (sc != null) {
                sc.close().syncUninterruptibly();
            }
            group.shutdownGracefully();
            ReferenceCountUtil.release(sslClientCtx);

Domain

Subdomains

Frequently Asked Questions

What does testHandshakeWithExecutor() do?
testHandshakeWithExecutor() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java.
Where is testHandshakeWithExecutor() defined?
testHandshakeWithExecutor() is defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java at line 1084.
What calls testHandshakeWithExecutor()?
testHandshakeWithExecutor() is called by 16 function(s): testHandshakeMTLSWithExecutorJDK, testHandshakeMTLSWithExecutorOpenSsl, testHandshakeMTLSWithExecutorThatExecuteDirectlyJDK, testHandshakeMTLSWithExecutorThatExecuteDirectlyOpenSsl, testHandshakeMTLSWithImmediateEventExecutorJDK, testHandshakeMTLSWithImmediateEventExecutorOpenSsl, testHandshakeMTLSWithImmediateExecutorJDK, testHandshakeMTLSWithImmediateExecutorOpenSsl, and 8 more.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free