Home / Function/ testMultipleHandshakes() — netty Function Reference

testMultipleHandshakes() — netty Function Reference

Architecture documentation for the testMultipleHandshakes() function in JdkDelegatingPrivateKeyMethodTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a7f8dd70_f64f_5b30_337b_7aeea3a1751c["testMultipleHandshakes()"]
  2ac7122d_91ea_6ce8_76a0_fb9ed7fcbdbc["JdkDelegatingPrivateKeyMethodTest"]
  a7f8dd70_f64f_5b30_337b_7aeea3a1751c -->|defined in| 2ac7122d_91ea_6ce8_76a0_fb9ed7fcbdbc
  258ca29b_254c_5099_2a8a_08100b96b77c["runClient()"]
  a7f8dd70_f64f_5b30_337b_7aeea3a1751c -->|calls| 258ca29b_254c_5099_2a8a_08100b96b77c
  style a7f8dd70_f64f_5b30_337b_7aeea3a1751c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethodTest.java lines 292–347

    @Test
    void testMultipleHandshakes() throws Exception {
        // Create certificate and wrap the private key
        PrivateKey wrappedPrivateKey = wrapPrivateKey(RSA_BUNDLE.getKeyPair().getPrivate());
        X509Certificate certificate = RSA_BUNDLE.getCertificate();

        // Set up contexts
        SslContext serverSslContext = SslContextBuilder.forServer(wrappedPrivateKey, certificate)
                .sslProvider(SslProvider.OPENSSL)
                .option(OpenSslContextOption.USE_JDK_PROVIDER_SIGNATURES, true)
                .build();

        SslContext clientSslContext = SslContextBuilder.forClient()
                .sslProvider(SslProvider.OPENSSL)
                .trustManager(certificate)
                .build();

        // Test multiple connections to ensure provider caching works correctly
        int numberOfConnections = 3;
        List<Future<String>> results = new ArrayList<>();

        // Set up server
        ServerBootstrap serverBootstrap = new ServerBootstrap()
                .group(GROUP)
                .channel(NioServerSocketChannel.class)
                .childHandler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    protected void initChannel(SocketChannel ch) {
                        ChannelPipeline pipeline = ch.pipeline();
                        SslHandler sslHandler = serverSslContext.newHandler(ch.alloc());
                        pipeline.addLast(sslHandler);
                        pipeline.addLast(ServerHandler.INSTANCE);
                    }
                });

        ChannelFuture serverChannelFuture = serverBootstrap.bind(0).sync();
        Channel serverChannel = serverChannelFuture.channel();
        int serverPort = ((java.net.InetSocketAddress) serverChannel.localAddress()).getPort();

        try {
            // Create multiple client connections
            for (int i = 0; i < numberOfConnections; i++) {
                results.add(runClient(serverPort, clientSslContext));
            }

            // Wait for all connections to complete
            for (Future<String> result : results) {
                assertEquals("R", result.get(20, TimeUnit.SECONDS),
                          "All connections should complete within timeout");
            }
        } finally {
            serverChannel.close().sync();
            ReferenceCountUtil.release(serverSslContext);
            ReferenceCountUtil.release(clientSslContext);
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testMultipleHandshakes() do?
testMultipleHandshakes() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethodTest.java.
Where is testMultipleHandshakes() defined?
testMultipleHandshakes() is defined in handler/src/test/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethodTest.java at line 292.
What does testMultipleHandshakes() call?
testMultipleHandshakes() calls 1 function(s): runClient.

Analyze Your Own Codebase

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

Try Supermodel Free