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

Examples of org.apache.http.nio.impl.reactor.SessionInputBuffer


        int linebuffersize = buffersize;
        if (linebuffersize > 512) {
            linebuffersize = 512;
        }
       
        this.inbuf = new SessionInputBuffer(buffersize, linebuffersize);
        this.inbuf.reset(params);
        this.outbuf = new SessionOutputBuffer(buffersize, linebuffersize);
        this.outbuf.reset(params);
        this.lineBuffer = new CharArrayBuffer(64);
       
View Full Code Here


    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);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
       
        int bytesRead = decoder.read(dst);
View Full Code Here

        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 16);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
       
        int bytesRead = decoder.read(dst);
View Full Code Here

    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);
       
        ByteBuffer dst = ByteBuffer.allocate(4);
       
        int bytesRead = decoder.read(dst);
View Full Code Here

   
    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);
       
        assertEquals(6, inbuf.length());
       
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 16);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
       
View Full Code Here

        ReadableByteChannel channel = new ReadableByteChannelMockup(
                new String[] {
                        "stuff;",
                        "more stuff; and a lot more stuff"}, "US-ASCII");
       
        SessionInputBuffer inbuf = new SessionInputBuffer(1024, 256);
        inbuf.fill(channel);
        inbuf.fill(channel);
       
        assertEquals(38, inbuf.length());
       
        LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(channel, inbuf, 16);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
       
View Full Code Here

    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);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // ignore
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);
       
        try {
            decoder.read(null);
            fail("IllegalArgumentException should have been thrown");
View Full Code Here

    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);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
       
        int bytesRead = decoder.read(dst);
View Full Code Here

   
    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);
       
        ByteBuffer dst = ByteBuffer.allocate(1024);
       
View Full Code Here

TOP

Related Classes of org.apache.http.nio.impl.reactor.SessionInputBuffer

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.