@Override
    public int available() {
        final SharedOutputBuffer buffer = bufferRef.get();
        if (buffer != null) {
            return buffer.length();
        }
        return 0;
    }
TODO: to be replaced by core functionality
httpclient5/src/main/java/org/apache/hc/client5/http/impl/compat/ClassicToAsyncRequestProducer.java