Package java.nio.channels

Examples of java.nio.channels.ReadableByteChannel


        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, null, requestFactory, params);
       
        ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n");
        requestParser.fillBuffer(channel);
        HttpRequest request = (HttpRequest) requestParser.parse();
        assertNotNull(request);
        assertEquals(1, request.getAllHeaders().length);
        assertEquals("one", request.getFirstHeader("Header").getValue());
View Full Code Here


        SessionInputBuffer inbuf = new SessionInputBufferImpl(2, 128, params);
        HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();

        params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 2);
        HttpRequestParser requestParser = new HttpRequestParser(inbuf, null, requestFactory, params);
        ReadableByteChannel channel = newChannel("GET / HTTP/1.0\r\nHeader: one\r\n\r\n");
        assertEquals(2, requestParser.fillBuffer(channel));
        assertNull(requestParser.parse());
        assertEquals(4, requestParser.fillBuffer(channel));
        try {
            requestParser.parse();
View Full Code Here

            reader.close();
        }
    }

    public void testBasicDecoding() throws Exception {
        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();
View Full Code Here

        assertEquals(-1, bytesRead);
        assertTrue(decoder.isCompleted());
    }
   
    public void testCodingBeyondContentLimit() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
View Full Code Here

        assertEquals(-1, bytesRead);
        assertTrue(decoder.isCompleted());
    }

    public void testBasicDecodingSmallBuffer() throws Exception {
        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();
View Full Code Here

        assertEquals(-1, bytesRead);
        assertTrue(decoder.isCompleted());
    }
   
    public void testDecodingFromSessionBuffer1() throws Exception {
        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();
View Full Code Here

        assertEquals(-1, bytesRead);
        assertTrue(decoder.isCompleted());
    }

    public void testDecodingFromSessionBuffer2() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
View Full Code Here

        assertEquals(-1, bytesRead);
        assertTrue(decoder.isCompleted());
    }

    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();
View Full Code Here

       
        fileHandle.delete();
    }
   
    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();
View Full Code Here

       
        fileHandle.delete();
    }
   
    public void testCodingBeyondContentLimitFile() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
        HttpParams params = new BasicHttpParams();
       
View Full Code Here

TOP

Related Classes of java.nio.channels.ReadableByteChannel

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.