Home / Function/ testSniHandlerFiresHandshakeTimeout() — netty Function Reference

testSniHandlerFiresHandshakeTimeout() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  74fbc2cf_a876_3ce1_3b2f_2c84c2ebb196["testSniHandlerFiresHandshakeTimeout()"]
  00b45f27_cbf5_af92_430f_7f0426117fa5["SniHandlerTest"]
  74fbc2cf_a876_3ce1_3b2f_2c84c2ebb196 -->|defined in| 00b45f27_cbf5_af92_430f_7f0426117fa5
  style 74fbc2cf_a876_3ce1_3b2f_2c84c2ebb196 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java lines 764–796

    @Test
    public void testSniHandlerFiresHandshakeTimeout() throws Exception {
        SniHandler handler = new SniHandler(new Mapping<String, SslContext>() {
            @Override
            public SslContext map(String input) {
                throw new UnsupportedOperationException("Should not be called");
            }
        }, 0, 10);

        final AtomicReference<SniCompletionEvent> completionEventRef =
            new AtomicReference<SniCompletionEvent>();
        EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
            @Override
            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
                if (evt instanceof SniCompletionEvent) {
                    completionEventRef.set((SniCompletionEvent) evt);
                }
            }
        });
        try {
            while (completionEventRef.get() == null) {
                Thread.sleep(100);
                // We need to run all pending tasks as the handshake timeout is scheduled on the EventLoop.
                ch.runPendingTasks();
            }
            SniCompletionEvent completionEvent = completionEventRef.get();
            assertNotNull(completionEvent);
            assertNotNull(completionEvent.cause());
            assertEquals(SslHandshakeTimeoutException.class, completionEvent.cause().getClass());
        } finally {
            ch.finishAndReleaseAll();
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free