Home / Function/ testHandshake() — netty Function Reference

testHandshake() — netty Function Reference

Architecture documentation for the testHandshake() function in NettyBlockHoundIntegrationTest.java from the netty codebase.

Function java Buffer Search called by 2

Entity Profile

Dependency Diagram

graph TD
  edf57887_2940_01ad_218b_8776ed46f6d7["testHandshake()"]
  746a8721_66e8_40dd_5dc1_a4c697fa84e4["NettyBlockHoundIntegrationTest"]
  edf57887_2940_01ad_218b_8776ed46f6d7 -->|defined in| 746a8721_66e8_40dd_5dc1_a4c697fa84e4
  6267f976_bc00_036d_8e25_89047efb2aca["testTrustManagerVerify()"]
  6267f976_bc00_036d_8e25_89047efb2aca -->|calls| edf57887_2940_01ad_218b_8776ed46f6d7
  fa42d7ef_0cad_c1cf_60b8_42fc05f6a05e["testHandshakeWithExecutor()"]
  fa42d7ef_0cad_c1cf_60b8_42fc05f6a05e -->|calls| edf57887_2940_01ad_218b_8776ed46f6d7
  style edf57887_2940_01ad_218b_8776ed46f6d7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java lines 498–545

    private static void testHandshake(SslContext sslClientCtx, SslHandler clientSslHandler,
                                      SslHandler serverSslHandler) throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        Channel sc = null;
        Channel cc = null;
        try {
            sc = new ServerBootstrap()
                    .group(group)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(serverSslHandler)
                    .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)
                              .addLast(new ChannelInboundHandlerAdapter() {

                                  @Override
                                  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
                                      if (evt instanceof SslHandshakeCompletionEvent &&
                                              ((SslHandshakeCompletionEvent) evt).cause() != null) {
                                          ((SslHandshakeCompletionEvent) evt).cause().printStackTrace();
                                      }
                                      ctx.fireUserEventTriggered(evt);
                                  }
                              });
                        }
                    }).connect(sc.localAddress());
            cc = future.syncUninterruptibly().channel();

            clientSslHandler.handshakeFuture().await().sync();
            serverSslHandler.handshakeFuture().await().sync();
        } 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 testHandshake() do?
testHandshake() is a function in the netty codebase, defined in transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java.
Where is testHandshake() defined?
testHandshake() is defined in transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java at line 498.
What calls testHandshake()?
testHandshake() is called by 2 function(s): testHandshakeWithExecutor, testTrustManagerVerify.

Analyze Your Own Codebase

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

Try Supermodel Free