@Test
public void testSize4Varint() {

    final int size = 4;
    final int num = 0x200000;
    assertThat(ProtobufVarint32LengthFieldPrepender.computeRawVarint32Size(num), is(size));
    final byte[] buf = new byte[size + num];
    /**
     * 8    0    8    0    8    0    0    1
     * 1000 0000 1000 0000 1000 0000 0000 0001
     * 0000 0000 0000 0000 0000 0000 0000 0001
     * 0000 0001 0000 0000 0000 0000 0000 0000
     *  000 0001  000 0000  000 0000  000 0000
     *
     *    0000 0010 0000 0000 0000 0000 0000
     *    0    2    0    0    0    0    0
     *
     */
    buf[0] = (byte) (0x80 & 0xFF);
    buf[1] = (byte) (0x80 & 0xFF);
    buf[2] = (byte) (0x80 & 0xFF);
    buf[3] = 0x01;
    for (int i = size; i < num + size; ++i) {
        buf[i] = 1;
    }
    assertTrue(ch.writeOutbound(wrappedBuffer(buf, size, buf.length - size)));
    ByteBuf expected = wrappedBuffer(buf);
    ByteBuf actual = ch.readOutbound();
    assertThat(actual, is(expected));
    assertFalse(ch.finish());
    expected.release();
    actual.release();
}