BHttpConnectionBase implements BHttpConnection { HttpEntity createIncomingEntity( final HttpMessage message, final SessionInputBuffer inBuffer, final InputStream inputStream, final long len) { return new IncomingHttpEntity( createContentInputStream(len, inBuffer, inputStream), len >= 0 ? len : -1, len == ContentLengthStrategy.CHUNKED, message.getFirstHeader(HttpHeaders.CONTENT_TYPE), message.getFirstHeader(HttpHeaders.CONTENT_ENCODING)); } BHttpConnectionBase(
            final Http1Config http1Config,
            final CharsetDecoder charDecoder,
            final CharsetEncoder charEncoder); @Override boolean isOpen(); @Override ProtocolVersion getProtocolVersion(); @Override SocketAddress getRemoteAddress(); @Override SocketAddress getLocalAddress(); @Override void setSocketTimeout(final Timeout timeout); @Override Timeout getSocketTimeout(); @Override void close(final CloseMode closeMode); @Override void close(); @Override boolean isDataAvailable(final Timeout timeout); @Override boolean isStale(); @Override void flush(); @Override SSLSession getSSLSession(); @Override EndpointDetails getEndpointDetails(); @Override String toString();  }
@Test public void testCreateEntityLengthDelimited() throws Exception { final InputStream inStream = Mockito.mock(InputStream.class); final ClassicHttpResponse message = new BasicClassicHttpResponse(200, "OK"); message.addHeader("Content-Length", "10"); message.addHeader("Content-Type", "stuff"); message.addHeader("Content-Encoding", "chunked"); final HttpEntity entity = conn.createIncomingEntity(message, conn.inBuffer, inStream, 10); Assert.assertNotNull(entity); Assert.assertFalse(entity.isChunked()); Assert.assertEquals(10, entity.getContentLength()); Assert.assertEquals("stuff", entity.getContentType()); Assert.assertEquals("chunked", entity.getContentEncoding()); final InputStream content = entity.getContent(); Assert.assertNotNull(content); Assert.assertTrue((content instanceof ContentLengthInputStream)); }
@Test public void testCreateEntityInputChunked() throws Exception { final InputStream inStream = Mockito.mock(InputStream.class); final ClassicHttpResponse message = new BasicClassicHttpResponse(200, "OK"); final HttpEntity entity = conn.createIncomingEntity(message, conn.inBuffer, inStream, ContentLengthStrategy.CHUNKED); Assert.assertNotNull(entity); Assert.assertTrue(entity.isChunked()); Assert.assertEquals(-1, entity.getContentLength()); final InputStream content = entity.getContent(); Assert.assertNotNull(content); Assert.assertTrue((content instanceof ChunkedInputStream)); }
@Test public void testCreateEntityInputUndefined() throws Exception { final InputStream inStream = Mockito.mock(InputStream.class); final ClassicHttpResponse message = new BasicClassicHttpResponse(200, "OK"); final HttpEntity entity = conn.createIncomingEntity(message, conn.inBuffer, inStream, ContentLengthStrategy.UNDEFINED); Assert.assertNotNull(entity); Assert.assertFalse(entity.isChunked()); Assert.assertEquals(-1, entity.getContentLength()); final InputStream content = entity.getContent(); Assert.assertNotNull(content); Assert.assertTrue((content instanceof IdentityInputStream)); }