source: class DefaultSessionUtilTest {
  
     TestClock clock;
     DefaultSessionUtil sessionUtil;
  
    @Test
    public void testGenerateRequestToken() {
  
target:     clock.setTime(0);
      byte[] key = "super secret password".getBytes();
      String destination = "test";
      long epoch = sessionUtil.getThirtySecondsStepsFromEpoch();
      byte[] sessionToken =
          sessionUtil.generateSessionToken(
              key, Unpooled.wrappedBuffer(destination.getBytes()), epoch);
  
      int r1 =
          sessionUtil.generateRequestToken(
              sessionToken, Unpooled.wrappedBuffer("a new request".getBytes()), epoch);
  
      clock.setTime(40000);
      int r2 =
          sessionUtil.generateRequestToken(
              sessionToken, Unpooled.wrappedBuffer("a new request".getBytes()), epoch);
      Assert.assertEquals(r1, r2);
      clock.setTime(40000);
  
      int r3 =
          sessionUtil.generateRequestToken(
              sessionToken, Unpooled.wrappedBuffer("another request".getBytes()), epoch + 1);
      Assert.assertNotEquals(r1, r3);
  
      clock.setTime(60000);
      int r4 =
          sessionUtil.generateRequestToken(
              sessionToken, Unpooled.wrappedBuffer("a new request".getBytes()), epoch + 2);
      Assert.assertNotEquals(r1, r4);
    }
  
  }