@Test
public void testTagGenerationWorksWithIdRollover() throws Exception {

   AmqpTransferTagGenerator tagGen = new AmqpTransferTagGenerator(false);
   Field urisField = tagGen.getClass().getDeclaredField("nextTagId");
   urisField.setAccessible(true);
   urisField.set(tagGen, Long.MAX_VALUE + 1);
   {
      byte[] tag = tagGen.getNextTag();
      ByteArrayInputStream bais = new ByteArrayInputStream(tag);
      DataInputStream dis = new DataInputStream(bais);
      assertEquals(8, tag.length);
      assertEquals(Long.MAX_VALUE + 1, dis.readLong());
   }
   {
      byte[] tag = tagGen.getNextTag();
      ByteArrayInputStream bais = new ByteArrayInputStream(tag);
      DataInputStream dis = new DataInputStream(bais);
      assertEquals(8, tag.length);
      assertEquals(Long.MAX_VALUE + 2, dis.readLong());
   }
}