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

Examples of org.apache.http.impl.nio.reactor.SessionInputBuffer.fill()


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


       
        SessionInputBuffer inbuf = new SessionInputBuffer(16, 16);
       
        ReadableByteChannel channel = newChannel("One\r\nTwo\r\nThree");
       
        inbuf.fill(channel);
       
        CharArrayBuffer line = new CharArrayBuffer(64);
       
        line.clear();
        assertTrue(inbuf.readLine(line, false));
View Full Code Here

        line.clear();
        assertFalse(inbuf.readLine(line, false));

        channel = newChannel("\r\nFour");
        inbuf.fill(channel);
       
        line.clear();
        assertTrue(inbuf.readLine(line, false));
        assertEquals("Three", line.toString());
View Full Code Here

       
        line.clear();
        assertTrue(inbuf.readLine(line, false));
        assertEquals("Three", line.toString());

        inbuf.fill(channel);
       
        line.clear();
        assertTrue(inbuf.readLine(line, true));
        assertEquals("Four", line.toString());
View Full Code Here

        SessionOutputBuffer outbuf = new SessionOutputBuffer(16, 16);
        SessionInputBuffer inbuf = new SessionInputBuffer(16, 16);
       
        ReadableByteChannel inChannel = newChannel("One\r\nTwo\r\nThree");
       
        inbuf.fill(inChannel);
       
        CharArrayBuffer line = new CharArrayBuffer(64);
       
        line.clear();
        assertTrue(inbuf.readLine(line, false));
View Full Code Here

       
        line.clear();
        assertFalse(inbuf.readLine(line, false));

        inChannel = newChannel("\r\nFour");
        inbuf.fill(inChannel);

        line.clear();
        assertTrue(inbuf.readLine(line, false));
        assertEquals("Three", line.toString());
View Full Code Here

        assertTrue(inbuf.readLine(line, false));
        assertEquals("Three", line.toString());

        outbuf.writeLine(line);
       
        inbuf.fill(inChannel);
       
        line.clear();
        assertTrue(inbuf.readLine(line, true));
        assertEquals("Four", line.toString());
View Full Code Here

        outbuf.flush(outChannel);

        ReadableByteChannel channel = newChannel(outstream.toByteArray());
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 16);
        inbuf.fill(channel);
       
        for (int i = 0; i < teststrs.length; i++) {
            assertEquals(teststrs[i], inbuf.readLine(true));
        }
        assertNull(inbuf.readLine(true));
View Full Code Here

        outbuf.flush(outChannel);

        ReadableByteChannel channel = newChannel(outstream.toByteArray());

        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 16);
        inbuf.fill(channel);
       
        assertEquals("a", inbuf.readLine(true));
        assertEquals("", inbuf.readLine(true));
        assertEquals("\r", inbuf.readLine(true));
        assertEquals("", inbuf.readLine(true));
View Full Code Here

        for (int i = 0; i < out.length; i++) {
            out[i] = (byte)('0' + i);
        }
        ReadableByteChannel channel = newChannel(out);       
        SessionInputBuffer inbuf = new SessionInputBuffer(16, 16);
        while (inbuf.fill(channel) > 0) {
        }

        byte[] in = new byte[40];
        for (int i = 0; i < in.length; i++) {
            in[i] = (byte)inbuf.read();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.