Home / Function/ testNonSslRecord() — netty Function Reference

testNonSslRecord() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java lines 152–188

    @ParameterizedTest(name = "{index}: sslProvider={0}")
    @MethodSource("data")
    public void testNonSslRecord(SslProvider provider) throws Exception {
        SslContext nettyContext = makeSslContext(provider, false);
        try {
            final AtomicReference<SslHandshakeCompletionEvent> evtRef =
                    new AtomicReference<SslHandshakeCompletionEvent>();
            SniHandler handler = new SniHandler(new DomainNameMappingBuilder<SslContext>(nettyContext).build());
            final EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
                @Override
                public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
                    if (evt instanceof SslHandshakeCompletionEvent) {
                        assertTrue(evtRef.compareAndSet(null, (SslHandshakeCompletionEvent) evt));
                    }
                }
            });

            try {
                final byte[] bytes = new byte[1024];
                bytes[0] = SslUtils.SSL_CONTENT_TYPE_ALERT;

                DecoderException e = assertThrows(DecoderException.class, new Executable() {
                    @Override
                    public void execute() throws Throwable {
                        ch.writeInbound(Unpooled.wrappedBuffer(bytes));
                    }
                });
                assertInstanceOf(NotSslRecordException.class, e.getCause());
                assertFalse(ch.finish());
            } finally {
                ch.finishAndReleaseAll();
            }
            assertInstanceOf(NotSslRecordException.class, evtRef.get().cause());
        } finally {
            releaseAll(nettyContext);
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

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