### Question:
DefaultHttp2HeadersEncoder implements Http2HeadersEncoder, Http2HeadersEncoder.Configuration { @Override public void encodeHeaders(final int streamId, final Http2Headers headers, final ByteBuf buffer) throws Http2Exception { try { if (tableSizeChangeOutput.isReadable()) { buffer.writeBytes(tableSizeChangeOutput); tableSizeChangeOutput.clear(); } hpackEncoder.encodeHeaders(streamId, buffer, headers, sensitivityDetector); } catch (final Http2Exception e) { throw e; } catch (final Throwable t) { throw connectionError( Http2Error.COMPRESSION_ERROR, t, "Failed encoding headers block: %s", t.getMessage()); } } DefaultHttp2HeadersEncoder();  DefaultHttp2HeadersEncoder(final SensitivityDetector sensitivityDetector);  DefaultHttp2HeadersEncoder(
      final SensitivityDetector sensitivityDetector, final boolean ignoreMaxHeaderListSize);  DefaultHttp2HeadersEncoder(
      final SensitivityDetector sensitivityDetector,
      final boolean ignoreMaxHeaderListSize,
      final int dynamicTableArraySizeHint);   DefaultHttp2HeadersEncoder(
      final SensitivityDetector sensitivityDetector, final HpackEncoder hpackEncoder); @Override void encodeHeaders(final int streamId, final Http2Headers headers, final ByteBuf buffer); @Override void maxHeaderTableSize(final long max); @Override long maxHeaderTableSize(); @Override void maxHeaderListSize(final long max); @Override long maxHeaderListSize(); @Override Configuration configuration();  }### Answer:
@Test public void encodeShouldSucceed() throws Http2Exception { final Http2Headers headers = headers(); final ByteBuf buf = Unpooled.buffer(); try { encoder.encodeHeaders(3 , headers, buf); assertTrue(buf.writerIndex() > 0); } finally { buf.release(); } }