Home / Class/ DefaultHttp2HeadersDecoderTest Class — netty Architecture

DefaultHttp2HeadersDecoderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f["DefaultHttp2HeadersDecoderTest"]
  c3289274_e619_1e79_4c45_1b70e7c6d7f8["DefaultHttp2HeadersDecoderTest.java"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|defined in| c3289274_e619_1e79_4c45_1b70e7c6d7f8
  89eba9c0_7235_37bf_5c18_0016d6c5b883["setup()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 89eba9c0_7235_37bf_5c18_0016d6c5b883
  15311d1c_6c37_d2a6_53b0_fde0a54e892f["decodeShouldSucceed()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 15311d1c_6c37_d2a6_53b0_fde0a54e892f
  c68e905c_e1da_0984_f700_2e74bb9a0735["testExceedHeaderSize()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| c68e905c_e1da_0984_f700_2e74bb9a0735
  13455804_c678_5d9f_7a50_4e3fae5e89ac["decodeLargerThanHeaderListSizeButLessThanGoAway()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 13455804_c678_5d9f_7a50_4e3fae5e89ac
  cfa0ebf4_ba11_94b8_58b6_16927cb641e7["decodeLargerThanHeaderListSizeButLessThanGoAwayWithInitialDecoderSettings()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| cfa0ebf4_ba11_94b8_58b6_16927cb641e7
  8b432249_72a0_c827_2ca4_3cfca81ebbf5["decodeLargerThanHeaderListSizeGoAway()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 8b432249_72a0_c827_2ca4_3cfca81ebbf5
  440e16f9_ecf9_5c0d_2297_f776e2f3a037["duplicatePseudoHeadersMustFailValidation()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 440e16f9_ecf9_5c0d_2297_f776e2f3a037
  92eb6721_f82b_370f_3f79_1a17e83ea9e0["decodingTrailersTeHeaderMustNotFailValidation()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 92eb6721_f82b_370f_3f79_1a17e83ea9e0
  0428a437_38df_61c4_8753_903ca4816b4c["decodingConnectionRelatedHeadersMustFailValidation()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 0428a437_38df_61c4_8753_903ca4816b4c
  33b49571_0849_d1eb_ddea_7d03a9c0beac["illegalFirstChar()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 33b49571_0849_d1eb_ddea_7d03a9c0beac
  31a01907_8203_8263_1030_614869a1d620["decodingInvalidHeaderValueMustFailValidationIfFirstCharIsIllegal()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 31a01907_8203_8263_1030_614869a1d620
  49b02935_3904_8f64_c4af_a60d4bb05fcc["illegalNotFirstChar()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 49b02935_3904_8f64_c4af_a60d4bb05fcc
  3e86d9da_0310_4ed1_23e7_bc063c56e096["decodingInvalidHeaderValueMustFailValidationIfANotFirstCharIsIllegal()"]
  bddf27d1_0dcd_a270_e076_3c8aa8b9b31f -->|method| 3e86d9da_0310_4ed1_23e7_bc063c56e096

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2HeadersDecoderTest.java lines 45–308

public class DefaultHttp2HeadersDecoderTest {

    private DefaultHttp2HeadersDecoder decoder;

    @BeforeEach
    public void setup() {
        decoder = new DefaultHttp2HeadersDecoder(false);
    }

    @Test
    public void decodeShouldSucceed() throws Exception {
        ByteBuf buf = encode(b(":method"), b("GET"), b("akey"), b("avalue"), randomBytes(), randomBytes());
        try {
            Http2Headers headers = decoder.decodeHeaders(0, buf);
            assertEquals(3, headers.size());
            assertEquals("GET", headers.method().toString());
            assertEquals("avalue", headers.get(new AsciiString("akey")).toString());
        } finally {
            buf.release();
        }
    }

    @Test
    public void testExceedHeaderSize() throws Exception {
        final int maxListSize = 100;
        decoder.configuration().maxHeaderListSize(maxListSize, maxListSize);
        final ByteBuf buf = encode(randomBytes(maxListSize), randomBytes(1));

        try {
            assertThrows(Http2Exception.class, new Executable() {
                @Override
                public void execute() throws Throwable {
                    decoder.decodeHeaders(0, buf);
                }
            });
        } finally {
            buf.release();
        }
    }

    @Test
    public void decodeLargerThanHeaderListSizeButLessThanGoAway() throws Exception {
        decoder.maxHeaderListSize(MIN_HEADER_LIST_SIZE, MAX_HEADER_LIST_SIZE);
        final ByteBuf buf = encode(b(":method"), b("GET"));
        final int streamId = 1;
        Http2Exception.HeaderListSizeException e =
                assertThrows(Http2Exception.HeaderListSizeException.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decoder.decodeHeaders(streamId, buf);
            }
        });
        assertEquals(streamId, e.streamId());
        buf.release();
    }

    @Test
    public void decodeLargerThanHeaderListSizeButLessThanGoAwayWithInitialDecoderSettings() throws Exception {
        final ByteBuf buf = encode(b(":method"), b("GET"), b("test_header"),
            b(String.format("%09000d", 0).replace('0', 'A')));
        final int streamId = 1;
        try {
            Http2Exception.HeaderListSizeException e = assertThrows(Http2Exception.HeaderListSizeException.class,
                    new Executable() {
                        @Override
                        public void execute() throws Throwable {
                            decoder.decodeHeaders(streamId, buf);
                        }
                    });
            assertEquals(streamId, e.streamId());
        } finally {
            buf.release();
        }
    }

    @Test
    public void decodeLargerThanHeaderListSizeGoAway() throws Exception {
        decoder.maxHeaderListSize(MIN_HEADER_LIST_SIZE, MIN_HEADER_LIST_SIZE);
        final ByteBuf buf = encode(b(":method"), b("GET"));
        final int streamId = 1;
        try {

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free