@Test
public void sendShouldWrapHttpClientResponse() throws IOException {

    HttpResponse clientResponse = mock(HttpResponse.class);
    HttpEntity httpEntity = mock(HttpEntity.class);
    InputStream inputStream = mock(InputStream.class);
    StatusLine statusLine = new BasicStatusLine(mock(ProtocolVersion.class), 123, "reason");
    Header contentType = new BasicHeader("somename", "contentType");
    Header contentEncoding = new BasicHeader("somename", "contentEncoding");
    when(httpEntity.getContent()).thenReturn(inputStream);
    when(client.execute(request)).thenReturn(clientResponse);
    HttpChannel.Response response = toTest.send();
    assertNull(response.getContentType());
    assertNull(response.getContentEncoding());
    assertSame(EmptyInputStream.INSTANCE, response.getEntity());
    when(clientResponse.getStatusLine()).thenReturn(statusLine);
    when(clientResponse.getFirstHeader("Content-Type")).thenReturn(contentType);
    when(clientResponse.getFirstHeader("Content-Encoding")).thenReturn(contentEncoding);
    when(clientResponse.getEntity()).thenReturn(httpEntity);
    assertSame(inputStream, response.getEntity());
    assertEquals("contentType", response.getContentType());
    assertEquals("contentEncoding", response.getContentEncoding());
    assertEquals(123, response.getStatusCode());
    assertEquals("reason", response.getStatusMessage());
    response.close();
    verify(httpEntity).consumeContent();
    verify(request).abort();
}