HpackDecoderTest Class — netty Architecture
Architecture documentation for the HpackDecoderTest class in HpackDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 499468ca_3853_024b_2b80_17090ef6cd43["HpackDecoderTest"] 9daa8c52_7d73_2e79_81c6_f941a32d6d28["HpackDecoderTest.java"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|defined in| 9daa8c52_7d73_2e79_81c6_f941a32d6d28 803e81fb_93c3_91d3_3be8_817882790338["String()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 803e81fb_93c3_91d3_3be8_817882790338 47ac4151_0b50_9884_0d18_472d1c51065d["decode()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 47ac4151_0b50_9884_0d18_472d1c51065d badbff7e_9253_fdf9_fb1d_9a4ad53823fa["setUp()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| badbff7e_9253_fdf9_fb1d_9a4ad53823fa 999a4746_07d1_eee6_8d1e_0acddc809fba["testDecodeULE128IntMax()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 999a4746_07d1_eee6_8d1e_0acddc809fba ee9ce413_aa7a_ea19_2a9f_c78ef160ea98["testDecodeULE128IntOverflow1()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| ee9ce413_aa7a_ea19_2a9f_c78ef160ea98 d713fbb7_e4e6_ab93_33b5_bf3cf1078f25["testDecodeULE128IntOverflow2()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| d713fbb7_e4e6_ab93_33b5_bf3cf1078f25 c6b23e0f_aa20_b97b_9568_efd00b7c86b9["testDecodeULE128LongMax()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| c6b23e0f_aa20_b97b_9568_efd00b7c86b9 0b13b338_7159_302e_da1a_1aae685fb5db["testDecodeULE128LongOverflow1()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 0b13b338_7159_302e_da1a_1aae685fb5db a6d96ef3_1db7_072f_f731_ad008fac0d91["testDecodeULE128LongOverflow2()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| a6d96ef3_1db7_072f_f731_ad008fac0d91 b459b2a7_e481_0f75_8cab_8f7b3a4be028["testSetTableSizeWithMaxUnsigned32BitValueSucceeds()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| b459b2a7_e481_0f75_8cab_8f7b3a4be028 28509047_a533_872a_5b1f_ff08cbee9557["testSetTableSizeOverLimitFails()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 28509047_a533_872a_5b1f_ff08cbee9557 4140e10a_a306_c7d9_5121_b4c68dc40536["testLiteralHuffmanEncodedWithEmptyNameAndValue()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 4140e10a_a306_c7d9_5121_b4c68dc40536 51319af5_f932_6124_b7f1_a0aba3c1b4c3["testLiteralHuffmanEncodedWithPaddingGreaterThan7Throws()"] 499468ca_3853_024b_2b80_17090ef6cd43 -->|method| 51319af5_f932_6124_b7f1_a0aba3c1b4c3
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/HpackDecoderTest.java lines 65–912
public class HpackDecoderTest {
private HpackDecoder hpackDecoder;
private Http2Headers mockHeaders;
private static String hex(String s) {
return StringUtil.toHexString(s.getBytes());
}
private void decode(String encoded) throws Http2Exception {
byte[] b = StringUtil.decodeHexDump(encoded);
ByteBuf in = Unpooled.wrappedBuffer(b);
try {
hpackDecoder.decode(0, in, mockHeaders, true);
} finally {
in.release();
}
}
@BeforeEach
public void setUp() {
hpackDecoder = new HpackDecoder(8192);
mockHeaders = mock(Http2Headers.class);
}
@Test
public void testDecodeULE128IntMax() throws Http2Exception {
byte[] input = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x07};
ByteBuf in = Unpooled.wrappedBuffer(input);
try {
assertEquals(MAX_VALUE, decodeULE128(in, 0));
} finally {
in.release();
}
}
@Test
public void testDecodeULE128IntOverflow1() throws Http2Exception {
byte[] input = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x07};
final ByteBuf in = Unpooled.wrappedBuffer(input);
final int readerIndex = in.readerIndex();
try {
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Throwable {
decodeULE128(in, 1);
}
});
} finally {
assertEquals(readerIndex, in.readerIndex());
in.release();
}
}
@Test
public void testDecodeULE128IntOverflow2() throws Http2Exception {
byte[] input = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x08};
final ByteBuf in = Unpooled.wrappedBuffer(input);
final int readerIndex = in.readerIndex();
try {
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Throwable {
decodeULE128(in, 0);
}
});
} finally {
assertEquals(readerIndex, in.readerIndex());
in.release();
}
}
@Test
public void testDecodeULE128LongMax() throws Http2Exception {
byte[] input = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0x7F};
ByteBuf in = Unpooled.wrappedBuffer(input);
try {
assertEquals(Long.MAX_VALUE, decodeULE128(in, 0L));
} finally {
in.release();
Source
Frequently Asked Questions
What is the HpackDecoderTest class?
HpackDecoderTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HpackDecoderTest.java.
Where is HpackDecoderTest defined?
HpackDecoderTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HpackDecoderTest.java at line 65.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free