public final <T> Future<T> execute(
            final String id,
            final AsyncRequestProducer requestProducer,
            final AsyncResponseConsumer<T> responseConsumer,
            final HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
            final HttpContext context,
            final FutureCallback<T> callback) {
        final BasicFuture<T> future = new BasicFuture<>(callback);
        execute(id, new BasicClientExchangeHandler<>(requestProducer, responseConsumer,
                        new FutureCallback<T>() {

                            @Override
                            public void completed(final T result) {
                                future.completed(result);
                            }

                            @Override
                            public void failed(final Exception ex) {
                                future.failed(ex);
                            }

                            @Override
                            public void cancelled() {
                                future.cancel();
                            }

                        }),
                pushHandlerFactory,
                context != null ? context : HttpCoreContext.create());
        return future;
    }
Initiates message exchange using the given request producer and response consumer.

@param id unique operation ID or {@code null}.
@param requestProducer the request producer.
@param responseConsumer the response consumer.
@param pushHandlerFactory the push handler factory.
@param context the execution context.
@param callback the result callback.
@param <T> the result representation.
@return the result future.
httpclient5/src/main/java/org/apache/hc/client5/http/nio/AsyncConnectionEndpoint.java