Home / Class/ Http2MultiplexCodecBuilderTest Class — netty Architecture

Http2MultiplexCodecBuilderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6f38501f_37dc_377c_36b1_15b1a68d236c["Http2MultiplexCodecBuilderTest"]
  5ceedd17_ac31_fdf2_0655_d52a5962554b["Http2MultiplexCodecBuilderTest.java"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|defined in| 5ceedd17_ac31_fdf2_0655_d52a5962554b
  564864af_320d_a64b_d256_ffccc5babb17["init()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| 564864af_320d_a64b_d256_ffccc5babb17
  ab467e32_50d5_0c66_6d96_7b56389f6927["setUp()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| ab467e32_50d5_0c66_6d96_7b56389f6927
  7c3e17c9_3fd1_b5a2_9781_e92ceb4da749["shutdown()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| 7c3e17c9_3fd1_b5a2_9781_e92ceb4da749
  b09a31a1_3393_ed5f_bf8f_e246c4d714a8["tearDown()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| b09a31a1_3393_ed5f_bf8f_e246c4d714a8
  3dafdf03_2c63_989a_6c2a_af242805f082["Http2StreamChannel()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| 3dafdf03_2c63_989a_6c2a_af242805f082
  dfc49e47_721e_23fc_d8ab_f452d62294df["multipleOutboundStreams()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| dfc49e47_721e_23fc_d8ab_f452d62294df
  0307cc1d_1dec_b337_a959_1d635d7a3613["createOutboundStream()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| 0307cc1d_1dec_b337_a959_1d635d7a3613
  eea3ee4a_4f3f_73fe_1a65_b6cc43de031b["testSharableCheck()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| eea3ee4a_4f3f_73fe_1a65_b6cc43de031b
  814ac94c_1b4f_cc08_f176_0ba7895a37b1["testUnsharableHandler()"]
  6f38501f_37dc_377c_36b1_15b1a68d236c -->|method| 814ac94c_1b4f_cc08_f176_0ba7895a37b1

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexCodecBuilderTest.java lines 55–268

public class Http2MultiplexCodecBuilderTest {

    private static EventLoopGroup group;
    private Channel serverChannel;
    private volatile Channel serverConnectedChannel;
    private Channel clientChannel;
    private LastInboundHandler serverLastInboundHandler;

    @BeforeAll
    public static void init() {
        group = new DefaultEventLoop();
    }

    @BeforeEach
    public void setUp() throws InterruptedException {
        final CountDownLatch serverChannelLatch = new CountDownLatch(1);
        LocalAddress serverAddress = new LocalAddress(getClass());
        serverLastInboundHandler = new SharableLastInboundHandler();
        ServerBootstrap sb = new ServerBootstrap()
                .channel(LocalServerChannel.class)
                .group(group)
                .childHandler(new ChannelInitializer<Channel>() {
                    @Override
                    protected void initChannel(Channel ch) throws Exception {
                        serverConnectedChannel = ch;
                        ch.pipeline().addLast(new Http2MultiplexCodecBuilder(true, new ChannelInitializer<Channel>() {

                            @Override
                            protected void initChannel(Channel ch) throws Exception {
                                ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                                    private boolean writable;

                                    @Override
                                    public void channelActive(ChannelHandlerContext ctx) throws Exception {
                                        writable |= ctx.channel().isWritable();
                                        super.channelActive(ctx);
                                    }

                                    @Override
                                    public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
                                        writable |= ctx.channel().isWritable();
                                        super.channelWritabilityChanged(ctx);
                                    }

                                    @Override
                                    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
                                        assertTrue(writable);
                                        super.channelInactive(ctx);
                                    }
                                });
                                ch.pipeline().addLast(serverLastInboundHandler);
                            }
                        }).build());
                        serverChannelLatch.countDown();
                    }
                });
        serverChannel = sb.bind(serverAddress).sync().channel();

        Bootstrap cb = new Bootstrap()
                .channel(LocalChannel.class)
                .group(group)
                .handler(new Http2MultiplexCodecBuilder(false, new ChannelInitializer<Channel>() {
                    @Override
                    protected void initChannel(Channel ch) throws Exception {
                        fail("Should not be called for outbound streams");
                    }
                }).build());
        clientChannel = cb.connect(serverAddress).sync().channel();
        assertTrue(serverChannelLatch.await(5, SECONDS));
    }

    @AfterAll
    public static void shutdown() {
        group.shutdownGracefully(0, 5, SECONDS);
    }

    @AfterEach
    public void tearDown() throws Exception {
        if (clientChannel != null) {
            clientChannel.close().syncUninterruptibly();
            clientChannel = null;

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free