Home / Function/ testTruncatedPacket() — netty Function Reference

testTruncatedPacket() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7cdd140b_e838_5f9e_3ed0_a6c7003e46e9["testTruncatedPacket()"]
  adaf7dc7_94e2_152f_ffdb_453fdaa4f25e["SslHandlerTest"]
  7cdd140b_e838_5f9e_3ed0_a6c7003e46e9 -->|defined in| adaf7dc7_94e2_152f_ffdb_453fdaa4f25e
  style 7cdd140b_e838_5f9e_3ed0_a6c7003e46e9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java lines 310–335

    @Test
    public void testTruncatedPacket() throws Exception {
        SSLEngine engine = newServerModeSSLEngine();
        final EmbeddedChannel ch = new EmbeddedChannel(new SslHandler(engine));

        // Push the first part of a 5-byte handshake message.
        ch.writeInbound(wrappedBuffer(new byte[]{22, 3, 1, 0, 5}));

        // Should decode nothing yet.
        assertNull(ch.readInbound());

        DecoderException e = assertThrows(DecoderException.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                // Push the second part of the 5-byte handshake message.
                ch.writeInbound(wrappedBuffer(new byte[]{2, 0, 0, 1, 0}));
            }
        });
        // Be sure we cleanup the channel and release any pending messages that may have been generated because
        // of an alert.
        // See https://github.com/netty/netty/issues/6057.
        ch.finishAndReleaseAll();

        // The pushed message is invalid, so it should raise an exception if it decoded the message correctly.
        assertInstanceOf(SSLProtocolException.class, e.getCause());
    }

Domain

Subdomains

Frequently Asked Questions

What does testTruncatedPacket() do?
testTruncatedPacket() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java.
Where is testTruncatedPacket() defined?
testTruncatedPacket() is defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java at line 310.

Analyze Your Own Codebase

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

Try Supermodel Free