@Test
public void testTagValueMatchesParsedArray() throws IOException {

   AmqpTransferTagGenerator tagGen = new AmqpTransferTagGenerator(false);
   for (int i = 0; i < Short.MAX_VALUE; ++i) {
      byte[] tag = tagGen.getNextTag();
      ByteArrayInputStream bais = new ByteArrayInputStream(tag);
      DataInputStream dis = new DataInputStream(bais);
      if (i < 256) {
         assertEquals(1, tag.length);
         assertEquals((byte) i, dis.readByte());
      } else {
         assertEquals(2, tag.length);
         assertEquals(i, dis.readShort());
      }
   }
}