Examples of SessionOutputBufferMock


Examples of org.apache.http.impl.SessionOutputBufferMock

    }

    @Test
    public void testBasics() throws Exception {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        final SessionOutputBufferMock datatransmitter = new SessionOutputBufferMock(buffer);
        final OutputStream out = new ContentLengthOutputStream(datatransmitter, 15L);

        final byte[] tmp = new byte[10];
        out.write(tmp, 0, 10);
        out.write(1);
        out.write(tmp, 0, 10);
        out.write(tmp, 0, 10);
        out.write(tmp);
        out.write(1);
        out.write(2);
        out.flush();
        out.close();
        final byte[] data = datatransmitter.getData();
        Assert.assertEquals(15, data.length);
    }
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.