Package org.apache.http.io

Examples of org.apache.http.io.SessionInputBuffer


            // expected
        }
    }

    public void testEntityWithInvalidContentLength() throws Exception {
        SessionInputBuffer datareceiver = new SessionInputBufferMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

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


            // expected
        }
    }

    public void testEntityNeitherContentLengthNorTransferEncoding() throws Exception {
        SessionInputBuffer datareceiver = new SessionInputBufferMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        // lenient mode
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        EntityDeserializer entitygen = new EntityDeserializer(
View Full Code Here

        assertFalse(instream instanceof ChunkedInputStream);
        assertTrue(instream instanceof IdentityInputStream);
    }

    public void testEntityContentType() throws Exception {
        SessionInputBuffer datareceiver = new SessionInputBufferMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        message.addHeader("Content-Type", "stuff");
        EntityDeserializer entitygen = new EntityDeserializer(
                new LaxContentLengthStrategy());
View Full Code Here

        assertNotNull(entity.getContentType());
        assertEquals("stuff", entity.getContentType().getValue());
    }

    public void testEntityContentEncoding() throws Exception {
        SessionInputBuffer datareceiver = new SessionInputBufferMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        message.addHeader("Content-Encoding", "what not");
        EntityDeserializer entitygen = new EntityDeserializer(
                new LaxContentLengthStrategy());
View Full Code Here

            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {});
            new HttpResponseParser(
                    inbuffer,
                    BasicLineParser.DEFAULT,
                    null,
                    new BasicHttpParams());
            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {});
            new HttpResponseParser(
                    inbuffer,
                    BasicLineParser.DEFAULT,
                    new DefaultHttpResponseFactory(),
                    null);
View Full Code Here

            "HTTP/1.1 200 OK\r\n" +
            "Server: whatever\r\n" +
            "Date: some date\r\n" +
            "Set-Cookie: c1=stuff\r\n" +
            "\r\n";
        SessionInputBuffer inbuffer = new SessionInputBufferMock(s, "US-ASCII");

        HttpResponseParser parser = new HttpResponseParser(
                inbuffer,
                BasicLineParser.DEFAULT,
                new DefaultHttpResponseFactory(),
View Full Code Here

        Assert.assertEquals(3, headers.length);
    }

    @Test
    public void testConnectionClosedException() throws Exception {
        SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {});

        HttpResponseParser parser = new HttpResponseParser(
                inbuffer,
                BasicLineParser.DEFAULT,
                new DefaultHttpResponseFactory(),
View Full Code Here

            "HTTP\000/1.1 200\000 OK\r\n" +
            "Server: wha\000tever\r\n" +
            "Date: some date\r\n" +
            "Set-Coo\000kie: c1=stuff\r\n" +
            "\000\r\n";
        SessionInputBuffer inbuffer = new SessionInputBufferMock(
                new TimeoutByteArrayInputStream(s.getBytes("US-ASCII")), 16);

        HttpResponseParser parser = new HttpResponseParser(
                inbuffer,
                BasicLineParser.DEFAULT,
View Full Code Here

            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {});
            new HttpRequestParser(
                    inbuffer,
                    BasicLineParser.DEFAULT,
                    null,
                    new BasicHttpParams());
            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {});
            new HttpRequestParser(
                    inbuffer,
                    BasicLineParser.DEFAULT,
                    new DefaultHttpRequestFactory(),
                    null);
View Full Code Here

            "GET / HTTP/1.1\r\n" +
            "Host: localhost\r\n" +
            "User-Agent: whatever\r\n" +
            "Cookie: c1=stuff\r\n" +
            "\r\n";
        SessionInputBuffer inbuffer = new SessionInputBufferMock(s, "US-ASCII");

        HttpRequestParser parser = new HttpRequestParser(
                inbuffer,
                BasicLineParser.DEFAULT,
                new DefaultHttpRequestFactory(),
View Full Code Here

TOP

Related Classes of org.apache.http.io.SessionInputBuffer

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.