Home / Function/ testFallbackToDefaultContext() — netty Function Reference

testFallbackToDefaultContext() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java lines 304–353

    @ParameterizedTest(name = "{index}: sslProvider={0}")
    @MethodSource("data")
    public void testFallbackToDefaultContext(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);
            EmbeddedChannel ch = new EmbeddedChannel(handler);

            // invalid
            byte[] message = {22, 3, 1, 0, 0};
            try {
                // Push the handshake message.
                ch.writeInbound(Unpooled.wrappedBuffer(message));
                // TODO(scott): This should fail because the engine should reject zero length records during handshake.
                // See https://github.com/netty/netty/issues/6348.
                // fail();
            } catch (Exception e) {
                // expected
            }

            ch.close();

            // When the channel is closed the SslHandler will write an empty buffer to the channel.
            ByteBuf buf = ch.readOutbound();
            // TODO(scott): if the engine is shutdown correctly then this buffer shouldn't be null!
            // See https://github.com/netty/netty/issues/6348.
            if (buf != null) {
                assertFalse(buf.isReadable());
                buf.release();
            }

            assertFalse(ch.finish());
            assertNull(handler.hostname());
            assertEquals(nettyContext, handler.sslContext());
        } finally {
            releaseAll(leanContext, leanContext2, nettyContext);
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testFallbackToDefaultContext() do?
testFallbackToDefaultContext() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java.
Where is testFallbackToDefaultContext() defined?
testFallbackToDefaultContext() is defined in handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java at line 304.
What does testFallbackToDefaultContext() call?
testFallbackToDefaultContext() 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