public int fill(final ByteBuffer src) {
        lock.lock();
        try {
            setInputMode();
            ensureAdjustedCapacity(buffer().position() + src.remaining());
            buffer().put(src);
            final int remaining = buffer().remaining();
            condition.signalAll();
            return remaining;
        } finally {
            lock.unlock();
        }
    }
TODO: to be replaced by core functionality
httpclient5/src/main/java/org/apache/hc/client5/http/impl/compat/SharedInputBuffer.java