@Test
public void executeAsyncDelegatesToFailureHandlerOnCreateClientRequestIOException() throws IOException {

    // given
    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();
    // when
    client.executeAsync(request, responseHandler);
    // then
    verify(responseHandler).failed(exceptionCaptor.capture());
    assertEquals(expectedMessage, exceptionCaptor.getValue().getMessage());
}