Package org.apache.http.nio.mockup

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


    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);
        int count = buffer.consumeContent(decoder);
        assertEquals(16, count);
        assertTrue(decoder.isCompleted());
       
        byte[] b1 = new byte[5];
       
        int len = buffer.read(b1);
        assertEquals("stuff", EncodingUtils.getAsciiString(b1, 0, len));
View Full Code Here


    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());
        int count = buffer.consumeContent(decoder);
        assertEquals(16, count);
        assertTrue(decoder.isCompleted());
       
        byte[] b1 = new byte[5];
       
        int len = buffer.read(b1);
        assertEquals("stuff", EncodingUtils.getAsciiString(b1, 0, len));
View Full Code Here

TOP

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

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.