@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)); }
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 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 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); }
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(); }
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();  }