@Override
    public void failed(final Exception cause) {
        try {
            exceptionRef.set(cause);
        } finally {
            countDownLatch.countDown();
        }
    }
TODO: to be replaced by core functionality
httpclient5/src/main/java/org/apache/hc/client5/http/impl/compat/ClassicToAsyncRequestProducer.java