@Override
    public int length() {
        lock.lock();
        try {
            return super.length();
        } finally {
            lock.unlock();
        }
    }
TODO: to be replaced by core functionality
httpclient5/src/main/java/org/apache/hc/client5/http/impl/compat/AbstractSharedBuffer.java