Home / Function/ testNonAsciiServerNameParsing() — netty Function Reference

testNonAsciiServerNameParsing() — netty Function Reference

Architecture documentation for the testNonAsciiServerNameParsing() function in SniHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9d09277d_ec2b_339c_e74b_86f8eaff441b["testNonAsciiServerNameParsing()"]
  00b45f27_cbf5_af92_430f_7f0426117fa5["SniHandlerTest"]
  9d09277d_ec2b_339c_e74b_86f8eaff441b -->|defined in| 00b45f27_cbf5_af92_430f_7f0426117fa5
  495097de_5185_3185_66b9_43abc32cf9ab["releaseAll()"]
  9d09277d_ec2b_339c_e74b_86f8eaff441b -->|calls| 495097de_5185_3185_66b9_43abc32cf9ab
  style 9d09277d_ec2b_339c_e74b_86f8eaff441b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java lines 254–302

    @ParameterizedTest(name = "{index}: sslProvider={0}")
    @MethodSource("data")
    public void testNonAsciiServerNameParsing(SslProvider provider) throws Exception {
        SslContext nettyContext = makeSslContext(provider, false);
        SslContext leanContext = makeSslContext(provider, false);
        SslContext leanContext2 = makeSslContext(provider, false);

        try {
            DomainNameMapping<SslContext> mapping = new DomainNameMappingBuilder<SslContext>(nettyContext)
                    .add("*.netty.io", nettyContext)
                    // input with custom cases
                    .add("*.LEANCLOUD.CN", leanContext)
                    // a hostname conflict with previous one, since we are using order-sensitive config,
                    // the engine won't be used with the handler.
                    .add("chat4.leancloud.cn", leanContext2)
                    .build();

            SniHandler handler = new SniHandler(mapping);
            final EmbeddedChannel ch = new EmbeddedChannel(handler);

            try {
                // hex dump of a client hello packet, which contains an invalid hostname "CHAT4。LEANCLOUD。CN"
                String tlsHandshakeMessageHex1 = "16030100";
                // part 2
                final String tlsHandshakeMessageHex = "bd010000b90303a74225676d1814ba57faff3b366" +
                        "3656ed05ee9dbb2a4dbb1bb1c32d2ea5fc39e0000000100008c0000001700150000164348" +
                        "415434E380824C45414E434C4F5544E38082434E000b000403000102000a00340032000e0" +
                        "00d0019000b000c00180009000a0016001700080006000700140015000400050012001300" +
                        "0100020003000f0010001100230000000d0020001e0601060206030501050205030401040" +
                        "20403030103020303020102020203000f00010133740000";

                // Push the handshake message.
                // Decode should fail because of the badly encoded "HostName" string in the SNI extension
                // that isn't ASCII as per RFC 6066 - https://tools.ietf.org/html/rfc6066#page-6
                ch.writeInbound(Unpooled.wrappedBuffer(StringUtil.decodeHexDump(tlsHandshakeMessageHex1)));

                assertThrows(DecoderException.class, new Executable() {
                    @Override
                    public void execute() throws Throwable {
                        ch.writeInbound(Unpooled.wrappedBuffer(StringUtil.decodeHexDump(tlsHandshakeMessageHex)));
                    }
                });
            } finally {
                ch.finishAndReleaseAll();
            }
        } finally {
            releaseAll(leanContext, leanContext2, nettyContext);
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testNonAsciiServerNameParsing() do?
testNonAsciiServerNameParsing() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java.
Where is testNonAsciiServerNameParsing() defined?
testNonAsciiServerNameParsing() is defined in handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java at line 254.
What does testNonAsciiServerNameParsing() call?
testNonAsciiServerNameParsing() calls 1 function(s): releaseAll.

Analyze Your Own Codebase

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

Try Supermodel Free