Home / Class/ Http2StreamFrameToHttpObjectCodecTest Class — netty Architecture

Http2StreamFrameToHttpObjectCodecTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  f77629dd_309f_f368_8220_46ddc65ad871["Http2StreamFrameToHttpObjectCodecTest"]
  eb2510c7_dfdd_893f_4a18_dbe452961c38["Http2StreamFrameToHttpObjectCodecTest.java"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|defined in| eb2510c7_dfdd_893f_4a18_dbe452961c38
  3a49472b_290a_90c3_6a04_897bb98c2a8e["testUpgradeEmptyFullResponse()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 3a49472b_290a_90c3_6a04_897bb98c2a8e
  2289a7b3_62c7_6341_62d6_e6e605fd2f90["encode100ContinueAsHttp2HeadersFrameThatIsNotEndStream()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 2289a7b3_62c7_6341_62d6_e6e605fd2f90
  9ea1461e_28a0_f1a7_464b_0db0d10d2fb0["encodeNonFullHttpResponse100ContinueIsRejected()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 9ea1461e_28a0_f1a7_464b_0db0d10d2fb0
  19716932_e937_50e6_edbc_c4926c32ae85["testUpgradeNonEmptyFullResponse()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 19716932_e937_50e6_edbc_c4926c32ae85
  2a3ca6a9_36af_0214_fcd4_9fdd6e5dba28["testUpgradeEmptyFullResponseWithTrailers()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 2a3ca6a9_36af_0214_fcd4_9fdd6e5dba28
  1d86bcf0_ac0b_3c50_abff_bceb6488ecc2["testUpgradeNonEmptyFullResponseWithTrailers()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 1d86bcf0_ac0b_3c50_abff_bceb6488ecc2
  5f1da209_ed21_18ae_a374_ca11eba9bd6a["testUpgradeHeaders()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 5f1da209_ed21_18ae_a374_ca11eba9bd6a
  d7b8d991_8951_c8d2_6c6e_6e3964cb5ee3["testUpgradeChunk()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| d7b8d991_8951_c8d2_6c6e_6e3964cb5ee3
  b64b25ca_41d6_502f_7343_d59ed224a1be["testUpgradeEmptyEnd()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| b64b25ca_41d6_502f_7343_d59ed224a1be
  d0589035_ab06_b77a_fc40_eed4f9caad19["testUpgradeDataEnd()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| d0589035_ab06_b77a_fc40_eed4f9caad19
  c6380747_cd3d_7c7c_4d28_652ca2b861c9["testUpgradeTrailers()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| c6380747_cd3d_7c7c_4d28_652ca2b861c9
  51d24f52_dc2f_6733_3bf9_43f3908ddf40["testUpgradeDataEndWithTrailers()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 51d24f52_dc2f_6733_3bf9_43f3908ddf40
  3d26536d_6afc_7a85_90d5_6ce631251f20["testDowngradeHeaders()"]
  f77629dd_309f_f368_8220_46ddc65ad871 -->|method| 3d26536d_6afc_7a85_90d5_6ce631251f20

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2StreamFrameToHttpObjectCodecTest.java lines 65–991

public class Http2StreamFrameToHttpObjectCodecTest {

    @Test
    public void testUpgradeEmptyFullResponse() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new Http2StreamFrameToHttpObjectCodec(true));
        assertTrue(ch.writeOutbound(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)));

        Http2HeadersFrame headersFrame = ch.readOutbound();
        assertEquals("200", headersFrame.headers().status().toString());
        assertTrue(headersFrame.isEndStream());

        assertNull(ch.readOutbound());
        assertFalse(ch.finish());
    }

    @Test
    public void encode100ContinueAsHttp2HeadersFrameThatIsNotEndStream() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new Http2StreamFrameToHttpObjectCodec(true));
        assertTrue(ch.writeOutbound(new DefaultFullHttpResponse(
                HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE)));

        Http2HeadersFrame headersFrame = ch.readOutbound();
        assertEquals("100", headersFrame.headers().status().toString());
        assertFalse(headersFrame.isEndStream());

        assertNull(ch.readOutbound());
        assertFalse(ch.finish());
    }

    @Test
    public void encodeNonFullHttpResponse100ContinueIsRejected() throws Exception {
        final EmbeddedChannel ch = new EmbeddedChannel(new Http2StreamFrameToHttpObjectCodec(true));
        assertThrows(EncoderException.class, new Executable() {
            @Override
            public void execute() {
                ch.writeOutbound(new DefaultHttpResponse(
                        HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
            }
        });
        ch.finishAndReleaseAll();
    }

    @Test
    public void testUpgradeNonEmptyFullResponse() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new Http2StreamFrameToHttpObjectCodec(true));
        ByteBuf hello = Unpooled.copiedBuffer("hello world", CharsetUtil.UTF_8);
        assertTrue(ch.writeOutbound(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, hello)));

        Http2HeadersFrame headersFrame = ch.readOutbound();
        assertEquals("200", headersFrame.headers().status().toString());
        assertFalse(headersFrame.isEndStream());

        Http2DataFrame dataFrame = ch.readOutbound();
        try {
            assertEquals("hello world", dataFrame.content().toString(CharsetUtil.UTF_8));
            assertTrue(dataFrame.isEndStream());
        } finally {
            dataFrame.release();
        }

        assertNull(ch.readOutbound());
        assertFalse(ch.finish());
    }

    @Test
    public void testUpgradeEmptyFullResponseWithTrailers() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new Http2StreamFrameToHttpObjectCodec(true));
        FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
        HttpHeaders trailers = response.trailingHeaders();
        trailers.set("key", "value");
        assertTrue(ch.writeOutbound(response));

        Http2HeadersFrame headersFrame = ch.readOutbound();
        assertEquals("200", headersFrame.headers().status().toString());
        assertFalse(headersFrame.isEndStream());

        Http2HeadersFrame trailersFrame = ch.readOutbound();
        assertEquals("value", trailersFrame.headers().get("key").toString());
        assertTrue(trailersFrame.isEndStream());

        assertNull(ch.readOutbound());

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free