Package org.apache.http.nio.reactor

Examples of org.apache.http.nio.reactor.SessionInputBuffer


        }
    }

    public void testLineLimitForFoldedHeader() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();

        params.setIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, 2);
        params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 15);       
        NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
View Full Code Here


        }
    }

    public void testMaxHeaderCount() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();

        params.setIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, 2);
        NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
        requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\nHeader: two\r\n\r\n"));
View Full Code Here

        }
    }

    public void testDetectLineLimitEarly() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBufferImpl(2, 128, params);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();

        params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 2);
        NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
        ReadableByteChannel channel = newChannel("GET / HTTP/1.0\r\nHeader: one\r\n\r\n");
View Full Code Here

                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();

        inbuf.fill(channel);
        inbuf.fill(channel);
       
        assertEquals(38, inbuf.length());
       
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 16);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
View Full Code Here

    public void testBasicDecodingFile() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 36);
       
        File fileHandle = File.createTempFile("testFile", ".txt");
View Full Code Here

    public void testDecodingFileWithBufferedSessionData() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 36);
       
        int i = inbuf.fill(channel);
        assertEquals(7, i);
       
        File fileHandle = File.createTempFile("testFile", ".txt");

        RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw");
View Full Code Here

    public void testDecodingFileWithOffsetAndBufferedSessionData() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 36);
       
        int i = inbuf.fill(channel);
        assertEquals(7, i);
       
        File fileHandle = File.createTempFile("testFile", ".txt");

        RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw");
View Full Code Here

    public void testWriteBeyondFileSize() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"a"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 1);
       
        File fileHandle = File.createTempFile("testFile", ".txt");
View Full Code Here

                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 16);
       
        File fileHandle = File.createTempFile("testFile", ".txt");
View Full Code Here

    public void testInvalidConstructor() {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        try {
            new LengthDelimitedDecoder(null, null, null, 10);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
View Full Code Here

TOP

Related Classes of org.apache.http.nio.reactor.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.