Home / Class/ HpackHuffmanTest Class — netty Architecture

HpackHuffmanTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19["HpackHuffmanTest"]
  238c7699_46bb_7236_63ae_090c91fcfd17["HpackHuffmanTest.java"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|defined in| 238c7699_46bb_7236_63ae_090c91fcfd17
  50a94b8c_1b90_1deb_a608_c0b19a7da5fd["testHuffman()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 50a94b8c_1b90_1deb_a608_c0b19a7da5fd
  86530dfe_de1f_9342_aae7_c33dc333ae06["testDecodeEOS()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 86530dfe_de1f_9342_aae7_c33dc333ae06
  fb89acf2_5667_f7a4_49e6_d5d1153bd66b["testDecodeIllegalPadding()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| fb89acf2_5667_f7a4_49e6_d5d1153bd66b
  9bc1d118_5085_5e75_e116_c5d8b0b8c47a["testDecodeExtraPadding()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 9bc1d118_5085_5e75_e116_c5d8b0b8c47a
  77bd92e1_043b_1cb8_9294_3691fa88f22c["testDecodeExtraPadding1byte()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 77bd92e1_043b_1cb8_9294_3691fa88f22c
  edb63c67_69ce_377c_ae0b_32ffecd27d8f["testDecodeExtraPadding2byte()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| edb63c67_69ce_377c_ae0b_32ffecd27d8f
  88e25c47_e8e7_f7e8_97d6_c2dd767907f7["testDecodeExtraPadding3byte()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 88e25c47_e8e7_f7e8_97d6_c2dd767907f7
  d00d6ab4_4446_5f9d_7be1_e9ddd334c015["testDecodeExtraPadding4byte()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| d00d6ab4_4446_5f9d_7be1_e9ddd334c015
  56194613_52c3_cadc_7e65_890b04501bcb["testDecodeExtraPadding29bit()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 56194613_52c3_cadc_7e65_890b04501bcb
  7607772d_825e_7325_1653_241e178dd62a["testDecodePartialSymbol()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 7607772d_825e_7325_1653_241e178dd62a
  abeb730a_2dc5_f18d_e1f4_542dd303b675["testEncoderSanitizingMultiByteCharacters()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| abeb730a_2dc5_f18d_e1f4_542dd303b675
  6e26cc30_14b9_4e43_25df_147213d8cca3["makeBuf()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| 6e26cc30_14b9_4e43_25df_147213d8cca3
  a5160cd1_45e2_8a78_1aa4_61fe3c7c57ab["roundTrip()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19 -->|method| a5160cd1_45e2_8a78_1aa4_61fe3c7c57ab

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/HpackHuffmanTest.java lines 48–247

public class HpackHuffmanTest {

    @Test
    public void testHuffman() throws Http2Exception {
        String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        for (int i = 0; i < s.length(); i++) {
            roundTrip(s.substring(0, i));
        }

        Random random = new Random(123456789L);
        byte[] buf = new byte[4096];
        random.nextBytes(buf);
        roundTrip(buf);
    }

    @Test
    public void testDecodeEOS() throws Http2Exception {
        final byte[] buf = new byte[4];
        for (int i = 0; i < 4; i++) {
            buf[i] = (byte) 0xFF;
        }
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decode(buf);
            }
        });
    }

    @Test
    public void testDecodeIllegalPadding() throws Http2Exception {
        final byte[] buf = new byte[1];
        buf[0] = 0x00; // '0', invalid padding
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decode(buf);
            }
        });
    }

    @Test
    public void testDecodeExtraPadding() throws Http2Exception {
        final byte[] buf = makeBuf(0x0f, 0xFF); // '1', 'EOS'
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decode(buf);
            }
        });
    }

    @Test
    public void testDecodeExtraPadding1byte() throws Http2Exception {
        final byte[] buf = makeBuf(0xFF);
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decode(buf);
            }
        });
    }

    @Test
    public void testDecodeExtraPadding2byte() throws Http2Exception {
        final byte[] buf = makeBuf(0x1F, 0xFF); // 'a'
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decode(buf);
            }
        });
    }

    @Test
    public void testDecodeExtraPadding3byte() throws Http2Exception {
        final byte[] buf = makeBuf(0x1F, 0xFF, 0xFF); // 'a'
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                decode(buf);

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free