Home / Function/ testHandshakeAndClosePromiseFailedOnRemoval() — netty Function Reference

testHandshakeAndClosePromiseFailedOnRemoval() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  cc6fe9aa_1e48_294f_0829_e1a8f2a80fc2["testHandshakeAndClosePromiseFailedOnRemoval()"]
  adaf7dc7_94e2_152f_ffdb_453fdaa4f25e["SslHandlerTest"]
  cc6fe9aa_1e48_294f_0829_e1a8f2a80fc2 -->|defined in| adaf7dc7_94e2_152f_ffdb_453fdaa4f25e
  0fd148d9_de21_9e3d_3bde_be07148f32de["userEventTriggered()"]
  cc6fe9aa_1e48_294f_0829_e1a8f2a80fc2 -->|calls| 0fd148d9_de21_9e3d_3bde_be07148f32de
  style cc6fe9aa_1e48_294f_0829_e1a8f2a80fc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java lines 272–308

    @Test
    @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
    public void testHandshakeAndClosePromiseFailedOnRemoval() throws Exception {
        SSLEngine engine = SSLContext.getDefault().createSSLEngine();
        engine.setUseClientMode(true);
        SslHandler handler = new SslHandler(engine);
        final AtomicReference<Throwable> handshakeRef = new AtomicReference<Throwable>();
        final AtomicReference<Throwable> closeRef = new AtomicReference<Throwable>();
        EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
            @Override
            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
                if (evt instanceof SslHandshakeCompletionEvent) {
                    handshakeRef.set(((SslHandshakeCompletionEvent) evt).cause());
                } else if (evt instanceof SslCloseCompletionEvent) {
                    closeRef.set(((SslCloseCompletionEvent) evt).cause());
                }
            }
        });
        assertFalse(handler.handshakeFuture().isDone());
        assertFalse(handler.sslCloseFuture().isDone());

        ch.pipeline().remove(handler);

        try {
            while (!handler.handshakeFuture().isDone() || handshakeRef.get() == null
                    || !handler.sslCloseFuture().isDone() || closeRef.get() == null) {
                Thread.sleep(10);
                // Continue running all pending tasks until we notified for everything.
                ch.runPendingTasks();
            }

            assertSame(handler.handshakeFuture().cause(), handshakeRef.get());
            assertSame(handler.sslCloseFuture().cause(), closeRef.get());
        } finally {
            ch.finishAndReleaseAll();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testHandshakeAndClosePromiseFailedOnRemoval() do?
testHandshakeAndClosePromiseFailedOnRemoval() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java.
Where is testHandshakeAndClosePromiseFailedOnRemoval() defined?
testHandshakeAndClosePromiseFailedOnRemoval() is defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java at line 272.
What does testHandshakeAndClosePromiseFailedOnRemoval() call?
testHandshakeAndClosePromiseFailedOnRemoval() calls 1 function(s): userEventTriggered.

Analyze Your Own Codebase

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

Try Supermodel Free