@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(); } }
@Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(boolean validateHeaders);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(boolean validateHeaders, HpackDecoder hpackDecoder); }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(boolean validateHeaders);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(boolean validateHeaders, HpackDecoder hpackDecoder); @Override void maxHeaderTableSize(long max); @Override long maxHeaderTableSize(); @Override void maxHeaderListSize(long max, long goAwayMax); @Override long maxHeaderListSize(); @Override long maxHeaderListSizeGoAway(); @Override Configuration configuration(); @Override Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock); }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(boolean validateHeaders);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(boolean validateHeaders, HpackDecoder hpackDecoder); @Override void maxHeaderTableSize(long max); @Override long maxHeaderTableSize(); @Override void maxHeaderListSize(long max, long goAwayMax); @Override long maxHeaderListSize(); @Override long maxHeaderListSizeGoAway(); @Override Configuration configuration(); @Override Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock);  }