ByteBuf buf = Unpooled.buffer(3,3);
ByteBufUtils.writeVarShort(buf, 32766);
assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
assertEquals("Two byte short written", 2, buf.readableBytes());
buf.clear();
buf.writeZero(3);
buf.clear();
buf.writeShort(32766);
assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());