Package org.apache.http

Examples of org.apache.http.WritableByteChannelMock.dump()


        conn.produceOutput(handler);

        Assert.assertNull(conn.getHttpResponse());
        Assert.assertNull(conn.contentEncoder);
        Assert.assertEquals("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" +
                "5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(Consts.ASCII));

        Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
    }

    @Test
View Full Code Here


        conn.produceOutput(handler);

        Assert.assertNull(conn.getHttpResponse());
        Assert.assertNull(conn.contentEncoder);
        Assert.assertEquals("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" +
                "5\r\na lot\r\n11\r\n of", wchannel.dump(Consts.ASCII));
        Assert.assertEquals(21, conn.outbuf.length());

        Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
        Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
    }
View Full Code Here

        Mockito.verify(outbuf, Mockito.times(1)).flush(channel);

        Assert.assertEquals(13, metrics.getBytesTransferred());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);
        Assert.assertEquals("header\r\nstuff", s);
    }

    @Test
    public void testCodingFragmentBufferingTinyFragments() throws Exception {
View Full Code Here

        Mockito.verify(outbuf, Mockito.times(3)).flush(channel);

        Assert.assertEquals(18, metrics.getBytesTransferred());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff---more stuff", s);
    }

    @Test
View Full Code Here

        Mockito.verify(outbuf, Mockito.times(2)).flush(channel);

        Assert.assertEquals(18, metrics.getBytesTransferred());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff---more stuff", s);
    }

    @Test
View Full Code Here

        Mockito.verify(outbuf, Mockito.times(2)).flush(channel);

        Assert.assertEquals(21, metrics.getBytesTransferred());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff------more stuff", s);
    }

    @Test
View Full Code Here

        Assert.assertEquals(8, metrics.getBytesTransferred());
        Assert.assertEquals(3, outbuf.length());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff-stuff", s);
    }

    @Test
View Full Code Here

        Assert.assertEquals(21, metrics.getBytesTransferred());
        Assert.assertEquals(0, outbuf.length());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff-much more stuff", s);
    }

    @Test
View Full Code Here

        Mockito.verify(outbuf, Mockito.times(4)).flush(channel);

        Assert.assertEquals(8, metrics.getBytesTransferred());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff---", s);
        Assert.assertEquals(3, outbuf.length());
    }
View Full Code Here

        Mockito.verify(outbuf, Mockito.times(1)).flush(channel);

        Assert.assertEquals(8, metrics.getBytesTransferred());

        outbuf.flush(channel);
        final String s = channel.dump(Consts.ASCII);

        Assert.assertEquals("stuff--m", s);
        Assert.assertEquals(0, outbuf.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.