下面列出了怎么用org.apache.http.conn.EofSensorInputStream的API类实例代码及写法,或者点击链接到github查看源代码。
@Test
void shouldCallAbortAndCloseOnConnectionReleaseTrigger() throws IOException {
final EofSensorInputStream stream = mock(EofSensorInputStream.class);
final HttpResponse response = mock(HttpResponse.class);
when(response.getEntity()).thenReturn(new InputStreamEntity(stream));
when(response.getAllHeaders()).thenReturn(new Header[0]);
new ApacheClientHttpResponse(response).close();
verify(stream).abortConnection();
verify(stream).close();
}