public Future<AsyncClientEndpoint> lease(
            final HttpHost host,
            final HttpContext context,
            final FutureCallback<AsyncClientEndpoint> callback) {
        Args.notNull(host, "Host");
        final BasicFuture<AsyncClientEndpoint> future = new BasicFuture<>(callback);
        if (!isRunning()) {
            future.failed(new CancellationException("Connection lease cancelled"));
            return future;
        }
        final HttpClientContext clientContext = HttpClientContext.castOrCreate(context);
        final RequestConfig requestConfig = clientContext.getRequestConfigOrDefault();
        final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout();
        @SuppressWarnings("deprecation")
        final Timeout connectTimeout = requestConfig.getConnectTimeout();
        leaseEndpoint(
                host,
                connectionRequestTimeout,
                connectTimeout,
                clientContext,
                new FutureCallback<AsyncConnectionEndpoint>() {

                    @Override
                    public void completed(final AsyncConnectionEndpoint result) {
                        future.completed(new InternalAsyncClientEndpoint(result));
                    }

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

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

                });
        return future;
    }
Minimal implementation of {@link CloseableHttpAsyncClient}. This client is
optimized for HTTP/1.1 and HTTP/2 message transport and does not support
advanced HTTP protocol functionality such as request execution via a proxy,
state management, authentication and request redirects.
<p>
Concurrent message exchanges executed by this client will get assigned to
separate connections leased from the connection pool.
</p>

@since 5.0
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java