@Test
public void encodeShortTextIsLiteral() throws Exception {

    ByteBuf in = Unpooled.wrappedBuffer(new byte[] {
        0x6e, 0x65, 0x74, 0x74, 0x79
    });
    ByteBuf out = Unpooled.buffer(7);
    snappy.encode(in, out, 5);
    ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
        0x05, // preamble length
        0x04 << 2, // literal tag + length
        0x6e, 0x65, 0x74, 0x74, 0x79 // "netty"
    });
    assertEquals("Encoded literal was invalid", expected, out);
    in.release();
    out.release();
    expected.release();
}