Package kg.apc.emulators

Examples of kg.apc.emulators.SocketChannelEmul


     * Test of readResponse method, of class HTTPRawSampler.
     */
    @Test
    public void testReadResponse() throws Exception {
        System.out.println("readResponse");
        SocketChannelEmul sock = new SocketChannelEmul();
        sock.setBytesToRead(ByteBuffer.wrap("test".getBytes()));
        SampleResult res = new SampleResult();
        res.sampleStart();
        byte[] expResult = "test".getBytes();
        byte[] result = instance.readResponse(sock, res);
        assertEquals(expResult.length, result.length);
View Full Code Here


    private class SocketChannelWithTimeoutsEmul extends SocketChannelWithTimeouts {

        protected SocketChannelWithTimeoutsEmul() throws IOException {
            super();
            selector = new SelectorEmul();
            SocketChannelEmul ce = new SocketChannelEmul();
            ce.configureBlocking(false);
            ce.setBytesToRead(ByteBuffer.wrap("test".getBytes()));
            socketChannel = ce;
            channelKey=new SelectionKeyEmul();
        }
View Full Code Here

    @Test
    public void testWrite_Empty() throws Exception {
        System.out.println("write");
        SocketChannelWithTimeoutsEmul instance = new SocketChannelWithTimeoutsEmul();
        SocketChannelEmul sc = (SocketChannelEmul) instance.socketChannel;
        assertEquals(4, instance.write(ByteBuffer.wrap("test".getBytes())));
        assertEquals(4, sc.getWrittenBytesCount());
        assertEquals(0, instance.write(ByteBuffer.wrap("".getBytes())));
        assertEquals(0, sc.getWrittenBytesCount());
    }
View Full Code Here

TOP

Related Classes of kg.apc.emulators.SocketChannelEmul

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.