Code example for HttpTransportMetricsImpl

0
 
    @Test 
    public void testCodingCompleted() throws Exception { 
        final WritableByteChannelMock channel = new WritableByteChannelMock(64);
        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128);
        final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
 
        final LengthDelimitedEncoder encoder = new LengthDelimitedEncoder(
                channel, outbuf, metrics, 5);
        encoder.write(CodecTestUtils.wrap("stuff"));
 
        try { 
            encoder.write(CodecTestUtils.wrap("more stuff"));
            Assert.fail("IllegalStateException should have been thrown");
        } catch (final IllegalStateException ex) {
            // ignore 
        } 
    } 
 
    @Test 
    public void testInvalidConstructor() {