Home / Function/ testSslCompletionEvents() — netty Function Reference

testSslCompletionEvents() — netty Function Reference

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

Function java Buffer Allocators calls 1 called by 4

Entity Profile

Dependency Diagram

graph TD
  e641ed3b_ccaa_1dab_a201_0cb843b166ca["testSslCompletionEvents()"]
  adaf7dc7_94e2_152f_ffdb_453fdaa4f25e["SslHandlerTest"]
  e641ed3b_ccaa_1dab_a201_0cb843b166ca -->|defined in| adaf7dc7_94e2_152f_ffdb_453fdaa4f25e
  fc58e45c_7b9c_c210_f97e_57bf446562d2["testSslCompletionEventsTls12JDK()"]
  fc58e45c_7b9c_c210_f97e_57bf446562d2 -->|calls| e641ed3b_ccaa_1dab_a201_0cb843b166ca
  ae9c2360_d445_e06b_aba3_af5bcaf31efc["testSslCompletionEventsTls12Openssl()"]
  ae9c2360_d445_e06b_aba3_af5bcaf31efc -->|calls| e641ed3b_ccaa_1dab_a201_0cb843b166ca
  02efa07f_95db_6995_b02f_cdeda7069ae0["testSslCompletionEventsTls13JDK()"]
  02efa07f_95db_6995_b02f_cdeda7069ae0 -->|calls| e641ed3b_ccaa_1dab_a201_0cb843b166ca
  c9d5c377_56c9_3937_c362_d020a396e693["testSslCompletionEventsTls13Openssl()"]
  c9d5c377_56c9_3937_c362_d020a396e693 -->|calls| e641ed3b_ccaa_1dab_a201_0cb843b166ca
  722bfd3a_d8b4_c552_b80f_eb587610c92c["SslCompletionEventHandler()"]
  e641ed3b_ccaa_1dab_a201_0cb843b166ca -->|calls| 722bfd3a_d8b4_c552_b80f_eb587610c92c
  style e641ed3b_ccaa_1dab_a201_0cb843b166ca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java lines 1731–1874

    private void testSslCompletionEvents(SslProvider provider, final String protocol, boolean clientClose)
            throws Exception {
        final SslContext sslClientCtx = SslContextBuilder.forClient()
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .protocols(protocol)
                .sslProvider(provider).build();

        final SelfSignedCertificate cert = CachedSelfSignedCertificate.getCachedCertificate();
        final SslContext sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert())
                .protocols(protocol)
                .sslProvider(provider).build();

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());

        final LinkedBlockingQueue<Channel> acceptedChannels =
                new LinkedBlockingQueue<Channel>();

        final LinkedBlockingQueue<SslHandshakeCompletionEvent> serverHandshakeCompletionEvents =
                new LinkedBlockingQueue<SslHandshakeCompletionEvent>();

        final LinkedBlockingQueue<SslHandshakeCompletionEvent> clientHandshakeCompletionEvents =
                new LinkedBlockingQueue<SslHandshakeCompletionEvent>();

        final LinkedBlockingQueue<SslCloseCompletionEvent> serverCloseCompletionEvents =
                new LinkedBlockingQueue<SslCloseCompletionEvent>();

        final LinkedBlockingQueue<SslCloseCompletionEvent> clientCloseCompletionEvents =
                new LinkedBlockingQueue<SslCloseCompletionEvent>();
        try {
            Channel sc = new ServerBootstrap()
                    .group(group)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            acceptedChannels.add(ch);
                            SslHandler handler = sslServerCtx.newHandler(ch.alloc());
                            if (!SslProtocols.TLS_v1_3.equals(protocol)) {
                                handler.setCloseNotifyReadTimeout(5, TimeUnit.SECONDS);
                            }
                            ch.pipeline().addLast(handler);
                            ch.pipeline().addLast(new SslCompletionEventHandler(
                                    serverHandshakeCompletionEvents, serverCloseCompletionEvents));
                        }
                    })
                    .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();

            Bootstrap bs = new Bootstrap()
                    .group(group)
                    .channel(NioSocketChannel.class)
                    .handler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            SslHandler handler = sslClientCtx.newHandler(
                                    ch.alloc(), "netty.io", 9999);
                            if (!SslProtocols.TLS_v1_3.equals(protocol)) {
                                handler.setCloseNotifyReadTimeout(5, TimeUnit.SECONDS);
                            }
                            ch.pipeline().addLast(handler);
                            ch.pipeline().addLast(
                                    new SslCompletionEventHandler(
                                            clientHandshakeCompletionEvents, clientCloseCompletionEvents));
                        }
                    })
                    .remoteAddress(sc.localAddress());

            Channel cc1 = bs.connect().sync().channel();
            Channel cc2 = bs.connect().sync().channel();

            // We expect 4 events as we have 2 connections and for each connection there should be one event
            // on the server-side and one on the client-side.
            for (int i = 0; i < 2; i++) {
                SslHandshakeCompletionEvent event = clientHandshakeCompletionEvents.take();
                assertTrue(event.isSuccess());
            }
            for (int i = 0; i < 2; i++) {
                SslHandshakeCompletionEvent event = serverHandshakeCompletionEvents.take();
                assertTrue(event.isSuccess());
            }

            assertEquals(0, clientCloseCompletionEvents.size());

Domain

Subdomains

Frequently Asked Questions

What does testSslCompletionEvents() do?
testSslCompletionEvents() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java.
Where is testSslCompletionEvents() defined?
testSslCompletionEvents() is defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java at line 1731.
What does testSslCompletionEvents() call?
testSslCompletionEvents() calls 1 function(s): SslCompletionEventHandler.
What calls testSslCompletionEvents()?
testSslCompletionEvents() is called by 4 function(s): testSslCompletionEventsTls12JDK, testSslCompletionEventsTls12Openssl, testSslCompletionEventsTls13JDK, testSslCompletionEventsTls13Openssl.

Analyze Your Own Codebase

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

Try Supermodel Free