Home / Class/ Http2MultiplexTest Class — netty Architecture

Http2MultiplexTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  4745ff96_ed57_3bd8_9861_4b786d0b6e09["Http2MultiplexTest"]
  4b1eda98_3154_4584_9f2e_e46b7f1020ae["Http2MultiplexTest.java"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|defined in| 4b1eda98_3154_4584_9f2e_e46b7f1020ae
  da683f30_6a69_1465_99de_75cc085572fc["C()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| da683f30_6a69_1465_99de_75cc085572fc
  9810de3c_154d_34bb_2bfb_2e4ff3b01b06["ChannelHandler()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 9810de3c_154d_34bb_2bfb_2e4ff3b01b06
  eb6c55af_f367_fc39_a20b_ef598a9cc236["setUp()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| eb6c55af_f367_fc39_a20b_ef598a9cc236
  0e8db0ba_c3b8_4988_0c4e_cb2334da4121["ChannelHandlerContext()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 0e8db0ba_c3b8_4988_0c4e_cb2334da4121
  77e9a8ba_c9ea_1fb0_b1cc_64b8a6901f65["tearDown()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 77e9a8ba_c9ea_1fb0_b1cc_64b8a6901f65
  26f27595_9620_5e84_3b3a_067a489503e6["writeUnknownFrame()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 26f27595_9620_5e84_3b3a_067a489503e6
  d45ddf66_eab6_c0be_847f_35066f6bc7ae["Http2StreamChannel()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| d45ddf66_eab6_c0be_847f_35066f6bc7ae
  90725e6e_8979_a0b2_92ee_955bdae8803f["readUnkownFrame()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 90725e6e_8979_a0b2_92ee_955bdae8803f
  16cd7729_2236_6702_269e_1ca7a3b68c51["readPriorityFrame()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 16cd7729_2236_6702_269e_1ca7a3b68c51
  1bdb6615_4148_2958_227b_3def5e67fbb6["headerAndDataFramesShouldBeDelivered()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 1bdb6615_4148_2958_227b_3def5e67fbb6
  28a6a39e_f11d_8cca_1164_0b0a2ea9d968["noRstFrameSentOnCloseViaListener()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 28a6a39e_f11d_8cca_1164_0b0a2ea9d968
  16710c82_6d83_3fc0_1646_b8a9cf5db759["headerMultipleContentLengthValidationShouldPropagate()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 16710c82_6d83_3fc0_1646_b8a9cf5db759
  22310e5e_1d27_c370_3f12_08faaaca2495["headerMultipleContentLengthValidationShouldPropagateWithEndStream()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09 -->|method| 22310e5e_1d27_c370_3f12_08faaaca2495

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java lines 88–1718

public abstract class Http2MultiplexTest<C extends Http2FrameCodec> {
    private final Http2Headers request = new DefaultHttp2Headers()
            .method(HttpMethod.GET.asciiName()).scheme(HttpScheme.HTTPS.name())
            .authority(new AsciiString("example.org")).path(new AsciiString("/foo"));

    private EmbeddedChannel parentChannel;
    private Http2FrameWriter frameWriter;
    private Http2FrameInboundWriter frameInboundWriter;
    private TestChannelInitializer childChannelInitializer;
    private C codec;

    private static final int initialRemoteStreamWindow = 1024;

    protected abstract C newCodec(TestChannelInitializer childChannelInitializer,  Http2FrameWriter frameWriter);
    protected abstract ChannelHandler newMultiplexer(TestChannelInitializer childChannelInitializer);

    @BeforeEach
    public void setUp() {
        childChannelInitializer = new TestChannelInitializer();
        parentChannel = new EmbeddedChannel();
        frameInboundWriter = new Http2FrameInboundWriter(parentChannel);
        parentChannel.connect(new InetSocketAddress(0));
        frameWriter = Http2TestUtil.mockedFrameWriter();
        codec = newCodec(childChannelInitializer, frameWriter);
        parentChannel.pipeline().addLast(codec);
        ChannelHandler multiplexer = newMultiplexer(childChannelInitializer);
        if (multiplexer != null) {
            parentChannel.pipeline().addLast(multiplexer);
        }

        parentChannel.runPendingTasks();
        parentChannel.pipeline().fireChannelActive();

        parentChannel.writeInbound(Http2CodecUtil.connectionPrefaceBuf());

        Http2Settings settings = new Http2Settings().initialWindowSize(initialRemoteStreamWindow);
        frameInboundWriter.writeInboundSettings(settings);

        verify(frameWriter).writeSettingsAck(eqCodecCtx(), anyChannelPromise());

        frameInboundWriter.writeInboundSettingsAck();

        Http2SettingsFrame settingsFrame = parentChannel.readInbound();
        assertNotNull(settingsFrame);
        Http2SettingsAckFrame settingsAckFrame = parentChannel.readInbound();
        assertNotNull(settingsAckFrame);

        // Handshake
        verify(frameWriter).writeSettings(eqCodecCtx(),
                anyHttp2Settings(), anyChannelPromise());
    }

    private ChannelHandlerContext eqCodecCtx() {
        return eq(codec.ctx);
    }

    @AfterEach
    public void tearDown() throws Exception {
        if (childChannelInitializer.handler instanceof LastInboundHandler) {
            ((LastInboundHandler) childChannelInitializer.handler).finishAndReleaseAll();
        }
        parentChannel.finishAndReleaseAll();
        codec = null;
    }

    // TODO(buchgr): Flush from child channel
    // TODO(buchgr): ChildChannel.childReadComplete()
    // TODO(buchgr): GOAWAY Logic
    // TODO(buchgr): Test ChannelConfig.setMaxMessagesPerRead

    @Test
    public void writeUnknownFrame() {
        Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter() {
            @Override
            public void channelActive(ChannelHandlerContext ctx) {
                ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
                ctx.writeAndFlush(new DefaultHttp2UnknownFrame((byte) 99, new Http2Flags()));
                ctx.fireChannelActive();
            }
        });
        assertTrue(childChannel.isActive());

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free