@Test void testStaticHuffmanValues() throws Exception { HpackContext ctx = new HpackContext(4096); for (int i = 2; i <= 14; i++) { Entry entry = ctx.get(i); assertTrue(entry.isStatic()); ByteBuffer buffer = ByteBuffer.wrap(entry.getStaticHuffmanValue()); int huff = 0xff & buffer.get(); assertEquals(0x80, (0x80 & huff)); int len = NBitInteger.decode(buffer, 7); assertEquals(len, buffer.remaining()); String value = Huffman.decode(buffer); assertEquals(entry.getHttpField().getValue(), value); } }
public Entry get(HttpField field) { Entry entry = fieldMap.get(field); if (entry == null) entry = STATIC_FIELD_MAP.get(field); return entry; }
HpackContext { public Entry get(HttpField field) { Entry entry = fieldMap.get(field); if (entry == null) entry = STATIC_FIELD_MAP.get(field); return entry; } }
HpackContext { public Entry get(HttpField field) { Entry entry = fieldMap.get(field); if (entry == null) entry = STATIC_FIELD_MAP.get(field); return entry; } HpackContext(int maxDynamicTableSize); }
HpackContext { public Entry get(HttpField field) { Entry entry = fieldMap.get(field); if (entry == null) entry = STATIC_FIELD_MAP.get(field); return entry; } HpackContext(int maxDynamicTableSize); void resize(int newMaxDynamicTableSize); Entry get(HttpField field); Entry get(String name); Entry get(int index); Entry get(HttpHeader header); static Entry getStatic(HttpHeader header); Entry add(HttpField field); int size(); int getDynamicTableSize(); int getMaxDynamicTableSize(); int index(Entry entry); static int staticIndex(HttpHeader header); @Override String toString(); }
HpackContext { public Entry get(HttpField field) { Entry entry = fieldMap.get(field); if (entry == null) entry = STATIC_FIELD_MAP.get(field); return entry; } HpackContext(int maxDynamicTableSize); void resize(int newMaxDynamicTableSize); Entry get(HttpField field); Entry get(String name); Entry get(int index); Entry get(HttpHeader header); static Entry getStatic(HttpHeader header); Entry add(HttpField field); int size(); int getDynamicTableSize(); int getMaxDynamicTableSize(); int index(Entry entry); static int staticIndex(HttpHeader header); @Override String toString(); static final String[][] STATIC_TABLE; static final int STATIC_SIZE; }