### Question:
HttpClient implements LifeCycle { public <T extends Response> void executeAsync( final Request request, final ResponseHandler<T> responseHandler, final HttpClientContext httpClientContext ) { HttpUriRequest clientRequest; try { clientRequest = createClientRequest(request); } catch (IOException e) { responseHandler.failed(e); return; } FutureCallback<HttpResponse> responseCallback = createCallback(responseHandler); getAsyncClient().execute( HttpAsyncMethods.create(clientRequest), asyncResponseConsumerFactory.create(), httpClientContext, responseCallback); } HttpClient(
            CloseableHttpAsyncClient asyncClient,
            ServerPool serverPool,
            RequestFactory requestFactory,
            HttpAsyncResponseConsumerFactory asyncResponseConsumerFactory
    ); T execute(
            Request clientRequest,
            BlockingResponseHandler<T> responseHandler
    ); void executeAsync(
            final Request request,
            final ResponseHandler<T> responseHandler,
            final HttpClientContext httpClientContext
    ); void executeAsync(
            final Request request,
            final ResponseHandler<T> responseHandler
    ); CloseableHttpAsyncClient getAsyncClient(); @Override void start(); @Override void stop(); @Override boolean isStarted(); @Override boolean isStopped();  }### Answer:
@Test public void executeAsyncDelegatesToFailureHandlerOnCreateClientRequestIOException() throws IOException { RequestFactory requestFactory = mock(RequestFactory.class); HttpClient client = createTestHttpClient( mock(CloseableHttpAsyncClient.class), mock(ServerPool.class), requestFactory, mock(HttpAsyncResponseConsumerFactory.class) ); String expectedMessage = UUID.randomUUID().toString(); BatchRequest request = createDefaultTestBatchRequest(); when(requestFactory.create(any(), any())).thenThrow(new IOException(expectedMessage)); ResponseHandler<Response> responseHandler = createMockTestResultHandler(); client.executeAsync(request, responseHandler); verify(responseHandler).failed(exceptionCaptor.capture()); assertEquals(expectedMessage, exceptionCaptor.getValue().getMessage()); }