@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) {
            // Default handler for any other types of errors that may have occurred. For example,
            // the Header builder throws IllegalArgumentException if the key or value was invalid
            // for any reason (e.g. the key was an invalid pseudo-header).
            throw connectionError(COMPRESSION_ERROR, e, "Error decoding headers: %s", e.getMessage());
        }
    }
@Test
    public void headerValuesAllowHorzontalTabAfterFirstCharacter() throws Exception {
        final DefaultHttp2HeadersDecoder decoder = new DefaultHttp2HeadersDecoder(true);
        ByteBuf buf = null;
        try {
            buf = encode(b(":method"), b("GET"), b("test_header"), b("a\tb"));
            Http2Headers headers = decoder.decodeHeaders(1, buf); // This must not throw.
            assertThat(headers.get("test_header")).isEqualToIgnoringCase("a\tb");
        } finally {
            ReferenceCountUtil.release(buf);
        }
    }