@Test
void shouldWrapIOException() throws IOException {

    final HttpAsyncResponseConsumer<HttpResponse> unit = new LogbookHttpAsyncResponseConsumer<>(createConsumer());
    final BasicHttpContext context = new BasicHttpContext();
    context.setAttribute(Attributes.STAGE, stage);
    final ResponseWritingStage last = mock(ResponseWritingStage.class);
    when(stage.process(any())).thenReturn(last);
    doThrow(new IOException()).when(last).write();
    assertThrows(UncheckedIOException.class, () ->
            unit.responseCompleted(context));
}