Package org.apache.http.nio.mockup

Examples of org.apache.http.nio.mockup.ReadableByteChannelMockup


        }
    }

    public void testInvalidInput() throws Exception {
        String s = "stuff";
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {s}, "US-ASCII");
   
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 3);
       
View Full Code Here


    public static Test suite() {
        return new TestSuite(TestBuffers.class);
    }

    public void testInputBufferOperations() throws IOException {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");
       
        ContentDecoder decoder = new MockupDecoder(channel);
       
        SimpleInputBuffer buffer = new SimpleInputBuffer(4);
View Full Code Here

        fin.close();
        return cb.flip().toString();
    }

    public void testBasicDecoding() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 16);
       
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");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
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");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 16);
       
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");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        inbuf.fill(channel);
       
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");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
View Full Code Here

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

    public void testInvalidConstructor() {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        try {
            new LengthDelimitedDecoder(null, null, 10);
View Full Code Here

        }
    }

    public void testInvalidInput() throws Exception {
        String s = "stuff";
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {s}, "US-ASCII");
   
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 3);
       
View Full Code Here

    }
   
   
    // ----------------------------------------------------- Test read
    public void testBasicDecodingFile() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 16);
       
View Full Code Here

TOP

Related Classes of org.apache.http.nio.mockup.ReadableByteChannelMockup

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.