Home / Function/ eventsOrder() — netty Function Reference

eventsOrder() — netty Function Reference

Architecture documentation for the eventsOrder() function in CloseNotifyTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8["eventsOrder()"]
  91635dfc_456c_fec9_4413_a1ee45d49032["CloseNotifyTest"]
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 -->|defined in| 91635dfc_456c_fec9_4413_a1ee45d49032
  57cc154b_b9c1_7bdd_c318_8f6ea3e5e55e["forwardData()"]
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 -->|calls| 57cc154b_b9c1_7bdd_c318_8f6ea3e5e55e
  aaff46e6_d1c4_937c_05e7_56dcbca48920["forwardAllWithCloseNotify()"]
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 -->|calls| aaff46e6_d1c4_937c_05e7_56dcbca48920
  d06bebe4_66af_bb53_d991_a0ac3abcdccf["jdkTls13()"]
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 -->|calls| d06bebe4_66af_bb53_d991_a0ac3abcdccf
  3b5ef0d4_0faf_0554_a2cf_8eddf09ebf76["assertCloseNotify()"]
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 -->|calls| 3b5ef0d4_0faf_0554_a2cf_8eddf09ebf76
  e3e1dd51_18ae_e079_751c_f22cc096ec24["discardEmptyOutboundBuffers()"]
  c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 -->|calls| e3e1dd51_18ae_e079_751c_f22cc096ec24
  style c8dc5de5_36bd_d22b_8ec3_7c93cc9586c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java lines 70–142

    @ParameterizedTest(name = "{index}: provider={0}, protocol={1}")
    @Timeout(30)
    @MethodSource("data")
    public void eventsOrder(SslProvider provider, String protocol) throws Exception {
        assumeTrue(provider != SslProvider.OPENSSL || OpenSsl.isAvailable(), "OpenSSL is not available");

        if (SslProtocols.TLS_v1_3.equals(protocol)) {
            // Ensure we support TLSv1.3
            assumeTrue(SslProvider.isTlsv13Supported(provider));
        }
        BlockingQueue<Object> clientEventQueue = new LinkedBlockingQueue<Object>();
        BlockingQueue<Object> serverEventQueue = new LinkedBlockingQueue<Object>();

        EmbeddedChannel clientChannel = initChannel(provider, protocol, true, clientEventQueue);
        EmbeddedChannel serverChannel = initChannel(provider, protocol, false, serverEventQueue);

        try {
            // handshake:
            forwardData(clientChannel, serverChannel);
            forwardData(serverChannel, clientChannel);
            forwardData(clientChannel, serverChannel);
            forwardData(serverChannel, clientChannel);
            assertInstanceOf(SslHandshakeCompletionEvent.class, clientEventQueue.poll());
            assertInstanceOf(SslHandshakeCompletionEvent.class, serverEventQueue.poll());
            assertEquals(protocol, handshakenProtocol(clientChannel));

            // send data:
            clientChannel.writeOutbound(writeAscii(ALLOC, "request_msg"));
            forwardData(clientChannel, serverChannel);
            assertEquals("request_msg", serverEventQueue.poll());

            // respond with data and close_notify:
            serverChannel.writeOutbound(writeAscii(ALLOC, "response_msg"));
            assertTrue(serverChannel.finish());
            assertInstanceOf(SslCloseCompletionEvent.class, serverEventQueue.poll());
            assertTrue(clientEventQueue.isEmpty());

            // consume server response with close_notify:
            forwardAllWithCloseNotify(serverChannel, clientChannel);
            assertEquals("response_msg", clientEventQueue.poll());
            assertInstanceOf(SslCloseCompletionEvent.class, clientEventQueue.poll());

            // make sure client automatically responds with close_notify:
            if (!jdkTls13(provider, protocol)) {
                // JDK impl of TLSv1.3 does not automatically generate "close_notify" in response to the received
                // "close_notify" alert. This is a legit behavior according to the spec:
                // https://tools.ietf.org/html/rfc8446#section-6.1. Handle it differently:
                assertCloseNotify((ByteBuf) clientChannel.readOutbound());
            }
        } finally {
            try {
                clientChannel.finish();
            } finally {
                serverChannel.finish();
            }
        }

        if (jdkTls13(provider, protocol)) {
            assertCloseNotify((ByteBuf) clientChannel.readOutbound());
        } else {
            discardEmptyOutboundBuffers(clientChannel);
        }

        assertEquals(INACTIVE, clientEventQueue.poll());
        assertTrue(clientEventQueue.isEmpty());
        assertEquals(INACTIVE, serverEventQueue.poll());
        assertTrue(serverEventQueue.isEmpty());

        assertFalse(clientChannel.releaseInbound());
        assertFalse(clientChannel.releaseOutbound());
        assertFalse(serverChannel.releaseInbound());
        assertFalse(serverChannel.releaseOutbound());
    }

Domain

Subdomains

Frequently Asked Questions

What does eventsOrder() do?
eventsOrder() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java.
Where is eventsOrder() defined?
eventsOrder() is defined in handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java at line 70.
What does eventsOrder() call?
eventsOrder() calls 5 function(s): assertCloseNotify, discardEmptyOutboundBuffers, forwardAllWithCloseNotify, forwardData, jdkTls13.

Analyze Your Own Codebase

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

Try Supermodel Free