Package org.apache.http

Examples of org.apache.http.ReadableByteChannelMock


*/
public class TestBuffers {

    @Test
    public void testInputBufferOperations() throws IOException {
        final ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff;", "more stuff"}, Consts.ASCII);

        final ContentDecoder decoder = new ContentDecoderMock(channel);

        final SimpleInputBuffer buffer = new SimpleInputBuffer(4, DirectByteBufferAllocator.INSTANCE);
View Full Code Here


*/
public class TestBuffers {

    @Test
    public void testInputBufferOperations() throws IOException {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");

        ContentDecoder decoder = new ContentDecoderMock(channel);

        SimpleInputBuffer buffer = new SimpleInputBuffer(4, new DirectByteBufferAllocator());
View Full Code Here

        }
    }

    @Test
    public void testBasicDecoding() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
View Full Code Here

        Assert.assertEquals(16, metrics.getBytesTransferred());
    }

    @Test
    public void testDecodingFromSessionBuffer() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
View Full Code Here

    }

    @Test
    public void testBasicDecodingFile() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        IdentityDecoder decoder = new IdentityDecoder(
View Full Code Here

        }
    }

    @Test
    public void testDecodingFileWithBufferedSessionData() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        IdentityDecoder decoder = new IdentityDecoder(
View Full Code Here

        deleteWithCheck(fileHandle);
    }

    @Test
    public void testDecodingFileWithOffsetAndBufferedSessionData() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        IdentityDecoder decoder = new IdentityDecoder(
View Full Code Here

        deleteWithCheck(fileHandle);
    }

    @Test
    public void testWriteBeyondFileSize() throws Exception {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"a"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        IdentityDecoder decoder = new IdentityDecoder(
View Full Code Here

        deleteWithCheck(fileHandle);
    }

    @Test
    public void testInvalidConstructor() {
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {"stuff;", "more stuff"}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        try {
            new IdentityDecoder(null, null, null);
View Full Code Here

    }

    @Test
    public void testInvalidInput() throws Exception {
        String s = "stuff";
        ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {s}, "US-ASCII");

        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
View Full Code Here

TOP

Related Classes of org.apache.http.ReadableByteChannelMock

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.