Home / Function/ testTimeout() — netty Function Reference

testTimeout() — netty Function Reference

Architecture documentation for the testTimeout() function in WebSocketProtocolHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0ec7ecda_41bb_a5d6_cec4_ed8eb07ab8de["testTimeout()"]
  4e6acdd6_0a1b_2423_42e3_58c47c3a2cd5["WebSocketProtocolHandlerTest"]
  0ec7ecda_41bb_a5d6_cec4_ed8eb07ab8de -->|defined in| 4e6acdd6_0a1b_2423_42e3_58c47c3a2cd5
  style 0ec7ecda_41bb_a5d6_cec4_ed8eb07ab8de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketProtocolHandlerTest.java lines 153–178

    @Test
    public void testTimeout() throws Exception {
        final AtomicReference<ChannelPromise> ref = new AtomicReference<ChannelPromise>();
        WebSocketProtocolHandler handler = new WebSocketProtocolHandler(
                false, WebSocketCloseStatus.NORMAL_CLOSURE, 1) { };
        EmbeddedChannel channel = new EmbeddedChannel(new ChannelOutboundHandlerAdapter() {
            @Override
            public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
                ref.set(promise);
                ReferenceCountUtil.release(msg);
            }
        }, handler);

        ChannelFuture future = channel.writeAndFlush(new CloseWebSocketFrame());
        ChannelHandlerContext ctx = channel.pipeline().context(WebSocketProtocolHandler.class);
        handler.close(ctx, ctx.newPromise());

        do {
            Thread.sleep(10);
            channel.runPendingTasks();
        } while (!future.isDone());

        assertInstanceOf(WebSocketHandshakeException.class, future.cause());
        assertFalse(ref.get().isDone());
        assertFalse(channel.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does testTimeout() do?
testTimeout() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketProtocolHandlerTest.java.
Where is testTimeout() defined?
testTimeout() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketProtocolHandlerTest.java at line 153.

Analyze Your Own Codebase

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

Try Supermodel Free