class StreamBufferingEncoder extends DecoratingHttp2ConnectionEncoder {

  @Override
  public void close() {
    try {
      if (!closed) {
        closed = true;

        // Fail all buffered streams.
        final Http2ChannelClosedException e = new Http2ChannelClosedException();
        while (!pendingStreams.isEmpty()) {
          final PendingStream stream = pendingStreams.pollFirstEntry().getValue();
          stream.close(e);
        }
      }
    } finally {
      super.close();
    }
  }

  public  StreamBufferingEncoder(final Http2ConnectionEncoder delegate);
  public  StreamBufferingEncoder(
      final Http2ConnectionEncoder delegate, final int initialMaxConcurrentStreams);

}