Package org.apache.http.impl.nio.reactor

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


        assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue());
    }
   
    public void testParsingBadlyFoldedFirstHeader() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);

        requestParser.fillBuffer(newChannel("GET /whatev"));
        HttpRequest request = (HttpRequest) requestParser.parse();
View Full Code Here


        assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue());
    }
   
    public void testParsingEmptyFoldedHeader() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);

        requestParser.fillBuffer(newChannel("GET /whatev"));
        HttpRequest request = (HttpRequest) requestParser.parse();
View Full Code Here

        assertEquals("stuff  more stuff", request.getFirstHeader("Some header").getValue());
    }
   
    public void testParsingIncompleteRequestLine() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
       
        ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0");
        requestParser.fillBuffer(channel);
View Full Code Here

        assertEquals(HttpVersion.HTTP_1_0, request.getRequestLine().getHttpVersion());
    }
   
    public void testParsingIncompleteHeader() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
       
        ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: whatever");
        requestParser.fillBuffer(channel);
View Full Code Here

        assertEquals("whatever", request.getFirstHeader("Header").getValue());
    }
   
    public void testParsingInvalidRequestLine() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
       
        ReadableByteChannel channel = newChannel("GET garbage\r\n");
        requestParser.fillBuffer(channel);
View Full Code Here

        }
    }
   
    public void testParsingInvalidStatusLine() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
        HttpResponseParser responseParser = new HttpResponseParser(inbuf, responseFactory, params);
       
        ReadableByteChannel channel = newChannel("HTTP 200 OK\r\n");
        responseParser.fillBuffer(channel);
View Full Code Here

        }
    }
   
    public void testParsingInvalidHeader() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
        HttpResponseParser responseParser = new HttpResponseParser(inbuf, responseFactory, params);
       
        ReadableByteChannel channel = newChannel("HTTP/1.0 200 OK\r\nstuff\r\n\r\n");
        responseParser.fillBuffer(channel);
View Full Code Here

        }
    }
   
    public void testResetParser() throws Exception {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
       
        ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n");
        requestParser.fillBuffer(channel);
View Full Code Here

        assertEquals("two", request.getFirstHeader("Header").getValue());
    }
   
    public void testInvalidConstructor() {
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
        try {
            new HttpRequestParser(null, null, params);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // ignore
View Full Code Here

        }
    }

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

        params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory, params);
        requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n"));
View Full Code Here

TOP

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