Package org.apache.http.impl

Examples of org.apache.http.impl.SessionInputBufferMock


            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (final IllegalArgumentException ex) {
            // expected
        }
        try {
            entitygen.deserialize(new SessionInputBufferMock(new byte[] {}) , null);
            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (final IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here


        }
    }

    @Test
    public void testEntityWithTransferEncoding() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock("0\r\n", Consts.ASCII);
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

    }

    @Test
    public void testEntityWithIdentityTransferEncoding() throws Exception {
        final SessionInputBuffer inbuffer =
            new SessionInputBufferMock(new byte[] {});
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertFalse(entity.isChunked());
    }

    @Test
    public void testEntityWithUnsupportedTransferEncoding() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock("0\r\n", Consts.ASCII);
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertTrue(entity.getContent() instanceof ChunkedInputStream);
    }

    @Test
    public void testChunkedTransferEncodingMustBeLast() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock("0\r\n", Consts.ASCII);
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertFalse(entity.getContent() instanceof ChunkedInputStream);
    }

    @Test
    public void testEntityWithContentLength() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {});
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertTrue(entity.getContent() instanceof ContentLengthInputStream);
    }

    @Test
    public void testEntityWithMultipleContentLength() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'});
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertTrue(instream instanceof ContentLengthInputStream);
    }

    @Test
    public void testEntityWithMultipleContentLengthSomeWrong() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'});
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertTrue(instream instanceof ContentLengthInputStream);
    }

    @Test
    public void testEntityWithMultipleContentLengthAllWrong() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'});
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

        Assert.assertTrue(instream instanceof IdentityInputStream);
    }

    @Test
    public void testEntityWithInvalidContentLength() throws Exception {
        final SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'});
        final HttpMessage message = new DummyHttpMessage();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

TOP

Related Classes of org.apache.http.impl.SessionInputBufferMock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.