Home / Class/ Http2HeaderBlockIOTest Class — netty Architecture

Http2HeaderBlockIOTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  67a68679_3177_7ad0_91a4_a6521917b637["Http2HeaderBlockIOTest"]
  ebc61050_b79c_cd7f_b3f1_4586d40ae369["Http2HeaderBlockIOTest.java"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|defined in| ebc61050_b79c_cd7f_b3f1_4586d40ae369
  6d2f149e_06f3_e3d2_bd73_66c6a48934ea["setup()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| 6d2f149e_06f3_e3d2_bd73_66c6a48934ea
  99d49c41_64b1_cc69_6bf2_d1056b89dc86["teardown()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| 99d49c41_64b1_cc69_6bf2_d1056b89dc86
  add5a324_0953_ea3b_73b9_21f63591857a["roundtripShouldBeSuccessful()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| add5a324_0953_ea3b_73b9_21f63591857a
  06aeaa6a_fbe8_53a7_4dfa_3070a240cdd1["successiveCallsShouldSucceed()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| 06aeaa6a_fbe8_53a7_4dfa_3070a240cdd1
  31b13965_a1cc_c8a5_8a49_abbb8fd213ac["setMaxHeaderSizeShouldBeSuccessful()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| 31b13965_a1cc_c8a5_8a49_abbb8fd213ac
  09cab6d1_a80c_8459_69c5_5ca78b3c180c["assertRoundtripSuccessful()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| 09cab6d1_a80c_8459_69c5_5ca78b3c180c
  3dcb4cf3_919d_527d_3792_77b699246b56["Http2Headers()"]
  67a68679_3177_7ad0_91a4_a6521917b637 -->|method| 3dcb4cf3_919d_527d_3792_77b699246b56

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2HeaderBlockIOTest.java lines 31–101

public class Http2HeaderBlockIOTest {

    private DefaultHttp2HeadersDecoder decoder;
    private DefaultHttp2HeadersEncoder encoder;
    private ByteBuf buffer;

    @BeforeEach
    public void setup() {
        encoder = new DefaultHttp2HeadersEncoder();
        decoder = new DefaultHttp2HeadersDecoder(false);
        buffer = Unpooled.buffer();
    }

    @AfterEach
    public void teardown() {
        buffer.release();
    }

    @Test
    public void roundtripShouldBeSuccessful() throws Http2Exception {
        Http2Headers in = headers();
        assertRoundtripSuccessful(in);
    }

    @Test
    public void successiveCallsShouldSucceed() throws Http2Exception {
        Http2Headers in = new DefaultHttp2Headers().method(new AsciiString("GET")).scheme(new AsciiString("https"))
                        .authority(new AsciiString("example.org")).path(new AsciiString("/some/path"))
                        .add(new AsciiString("accept"), new AsciiString("*/*"));
        assertRoundtripSuccessful(in);

        in = new DefaultHttp2Headers().method(new AsciiString("GET")).scheme(new AsciiString("https"))
                        .authority(new AsciiString("example.org")).path(new AsciiString("/some/path/resource1"))
                        .add(new AsciiString("accept"), new AsciiString("image/jpeg"))
                        .add(new AsciiString("cache-control"), new AsciiString("no-cache"));
        assertRoundtripSuccessful(in);

        in = new DefaultHttp2Headers().method(new AsciiString("GET")).scheme(new AsciiString("https"))
                        .authority(new AsciiString("example.org")).path(new AsciiString("/some/path/resource2"))
                        .add(new AsciiString("accept"), new AsciiString("image/png"))
                        .add(new AsciiString("cache-control"), new AsciiString("no-cache"));
        assertRoundtripSuccessful(in);
    }

    @Test
    public void setMaxHeaderSizeShouldBeSuccessful() throws Http2Exception {
        encoder.maxHeaderTableSize(10);
        Http2Headers in = headers();
        assertRoundtripSuccessful(in);
        assertEquals(10, decoder.maxHeaderTableSize());
    }

    private void assertRoundtripSuccessful(Http2Headers in) throws Http2Exception {
        encoder.encodeHeaders(3 /* randomly chosen */, in, buffer);

        Http2Headers out = decoder.decodeHeaders(0, buffer);
        assertEquals(in, out);
    }

    private static Http2Headers headers() {
        return new DefaultHttp2Headers(false).method(new AsciiString("GET")).scheme(new AsciiString("https"))
        .authority(new AsciiString("example.org")).path(new AsciiString("/some/path/resource2"))
                .add(new AsciiString("accept"), new AsciiString("image/png"))
                .add(new AsciiString("cache-control"), new AsciiString("no-cache"))
                .add(new AsciiString("custom"), new AsciiString("value1"))
                .add(new AsciiString("custom"), new AsciiString("value2"))
                .add(new AsciiString("custom"), new AsciiString("value3"))
                .add(new AsciiString("custom"), new AsciiString("custom4"))
                .add(randomString(), randomString());
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free