Home / Class/ Http2MultiplexHandlerTest Class — netty Architecture

Http2MultiplexHandlerTest Class — netty Architecture

Architecture documentation for the Http2MultiplexHandlerTest class in Http2MultiplexHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4fba49cb_e5ea_a2e3_d051_264ed1bec463["Http2MultiplexHandlerTest"]
  f1f547a9_2753_bbd5_dc68_138099dee77d["Http2MultiplexHandlerTest.java"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|defined in| f1f547a9_2753_bbd5_dc68_138099dee77d
  d85c783b_23ef_6fb7_ff9e_fb201cf4b38e["Http2FrameCodec()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| d85c783b_23ef_6fb7_ff9e_fb201cf4b38e
  45f02f16_516f_164a_f8ab_2b005f8025e7["ChannelHandler()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| 45f02f16_516f_164a_f8ab_2b005f8025e7
  965903c4_f741_bdbd_e9fa_350adf2ae790["useUserEventForResetFrame()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| 965903c4_f741_bdbd_e9fa_350adf2ae790
  48d1202e_7dc0_0768_3086_b1861dc01cbf["ignoreWindowUpdateFrames()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| 48d1202e_7dc0_0768_3086_b1861dc01cbf
  e07b478f_e0d5_dd5e_e4f9_f7da83a9fb6f["useUserEventForPriorityFrame()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| e07b478f_e0d5_dd5e_e4f9_f7da83a9fb6f
  15bc463c_ea2f_1ca2_6b0a_5d6d488db613["sslExceptionTriggersChildChannelException()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| 15bc463c_ea2f_1ca2_6b0a_5d6d488db613
  3f07b529_d623_5fd1_1a8f_d09ce5e41c4e["customExceptionForwarding()"]
  4fba49cb_e5ea_a2e3_d051_264ed1bec463 -->|method| 3f07b529_d623_5fd1_1a8f_d09ce5e41c4e

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexHandlerTest.java lines 32–112

public class Http2MultiplexHandlerTest extends Http2MultiplexTest<Http2FrameCodec> {

    @Override
    protected Http2FrameCodec newCodec(TestChannelInitializer childChannelInitializer, Http2FrameWriter frameWriter) {
        return new Http2FrameCodecBuilder(true).frameWriter(frameWriter).build();
    }

    @Override
    protected ChannelHandler newMultiplexer(TestChannelInitializer childChannelInitializer) {
        return new Http2MultiplexHandler(childChannelInitializer, null);
    }

    @Override
    protected boolean useUserEventForResetFrame() {
        return true;
    }

    @Override
    protected boolean ignoreWindowUpdateFrames() {
        return true;
    }

    @Override
    protected boolean useUserEventForPriorityFrame() {
        return true;
    }

    @Test
    public void sslExceptionTriggersChildChannelException() {
        final LastInboundHandler inboundHandler = new LastInboundHandler();
        Http2StreamChannel channel = newInboundStream(3, false, inboundHandler);
        assertTrue(channel.isActive());
        final RuntimeException testExc = new RuntimeException(new SSLException("foo"));
        channel.parent().pipeline().addLast(new ChannelInboundHandlerAdapter() {
            @Override
            public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                if (cause != testExc) {
                    super.exceptionCaught(ctx, cause);
                }
            }
        });
        channel.parent().pipeline().fireExceptionCaught(testExc);

        assertTrue(channel.isActive());
        RuntimeException exc = assertThrows(RuntimeException.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                inboundHandler.checkException();
            }
        });
        assertEquals(testExc, exc);
    }

    @Test
    public void customExceptionForwarding() {
        final LastInboundHandler inboundHandler = new LastInboundHandler();
        Http2StreamChannel channel = newInboundStream(3, false, inboundHandler);
        assertTrue(channel.isActive());
        final RuntimeException testExc = new RuntimeException("xyz");
        channel.parent().pipeline().addLast(new ChannelInboundHandlerAdapter() {
            @Override
            public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                if (cause != testExc) {
                    super.exceptionCaught(ctx, cause);
                } else {
                    ctx.pipeline().fireExceptionCaught(new Http2MultiplexActiveStreamsException(cause));
                }
            }
        });
        channel.parent().pipeline().fireExceptionCaught(testExc);

        assertTrue(channel.isActive());
        RuntimeException exc = assertThrows(RuntimeException.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                inboundHandler.checkException();
            }
        });
        assertEquals(testExc, exc);
    }
}

Frequently Asked Questions

What is the Http2MultiplexHandlerTest class?
Http2MultiplexHandlerTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexHandlerTest.java.
Where is Http2MultiplexHandlerTest defined?
Http2MultiplexHandlerTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexHandlerTest.java at line 32.

Analyze Your Own Codebase

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

Try Supermodel Free