### Question:
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(final int streamId, final 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 (final Http2Exception e) { throw e; } catch (final Throwable e) { throw connectionError(Http2Error.COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(final boolean validateHeaders);  DefaultHttp2HeadersDecoder(final boolean validateHeaders, final long maxHeaderListSize);  DefaultHttp2HeadersDecoder(
      final boolean validateHeaders,
      final long maxHeaderListSize,
      final int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(final boolean validateHeaders, final HpackDecoder hpackDecoder); @Override void maxHeaderTableSize(final long max); @Override long maxHeaderTableSize(); @Override void maxHeaderListSize(final long max, final long goAwayMax); @Override long maxHeaderListSize(); @Override long maxHeaderListSizeGoAway(); @Override Configuration configuration(); @Override Http2Headers decodeHeaders(final int streamId, final ByteBuf headerBlock);  }### Answer:
@Test public void decodeShouldSucceed() throws Exception { final ByteBuf buf = encode( b(":method"), b("GET"), b("akey"), b("avalue"), Http2TestUtil.randomBytes(), Http2TestUtil.randomBytes()); try { final 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 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 { decoder.decodeHeaders(streamId, buf); fail(); } catch (final Http2Exception.HeaderListSizeException e) { assertEquals(streamId, e.streamId()); } finally { buf.release(); } }