Package org.apache.http.nio.mockup

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


       
        tmpFile.delete();
    }
   
    public void testCodingBeyondContentLimitFile() 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


    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, new DirectByteBufferAllocator());
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);
        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf);
       
View Full Code Here

        assertEquals(-1, bytesRead);
        assertTrue(decoder.isCompleted());
    }
   
    public void testDecodingFromSessionBuffer() 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

        assertTrue(decoder.isCompleted());
    }

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

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

       
        tmpFile.delete();
    }
   
    public void testDecodingFromSessionBufferFile() 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

        return buffer.toString();
    }

    public void testBasicDecoding() throws Exception {
        String s = "5\r\n01234\r\n5\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n";
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {s}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        ChunkDecoder decoder = new ChunkDecoder(channel, inbuf);
       
View Full Code Here

    }

    public void testComplexDecoding() throws Exception {
        String s = "10;key=\"value\"\r\n1234567890123456\r\n" +
                "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1: abcde\r\nFooter2: fghij\r\n\r\n";
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {s}, "US-ASCII");
   
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        ChunkDecoder decoder = new ChunkDecoder(channel, inbuf);
       
View Full Code Here

    }

    public void testDecodingWithSmallBuffer() throws Exception {
        String s1 = "5\r\n01234\r\n5\r\n5678";
        String s2 = "9\r\n6\r\nabcdef\r\n0\r\n\r\n";
        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {s1, s2}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        ChunkDecoder decoder = new ChunkDecoder(channel, inbuf);
       
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.