### Question:
TokenUtils { public static byte[] getBytesOfToken(Token token) throws IOException { DataOutputBuffer buffer = new DataOutputBuffer(); token.write(buffer); return Arrays.copyOf(buffer.getData(), buffer.getLength()); }  static byte[] getBytesOfToken(Token token); static String[] getGroups(Token token); static Attribute getAttribute(Token token, String attrName); static long getRefreshTime(Token token); static boolean isExpired(Token token); static String encodeToken(byte[] token); static byte[] decodeToken(String token); static Token createTokenInstance(String tokenName, long id, 
      Secrets secrets, String issuer, String user, long issueInstant, 
      long notBefore, long notOnOrAfter, boolean encrypted); static T newInstance(Class<T> theClass, long id, 
      Secrets secrets, String issuer, String user, long issueInstant, 
      long notBefore, long notOnOrAfter, boolean encrypted);  }### Answer:
@Test public void testToken() throws Exception { Token identityToken = createToken(null, identityTokenName); byte[] tokenBytes = TokenUtils.getBytesOfToken(identityToken); System.out.println(tokenBytes.length); Token resultToken = TokenFactory.get().createIdentityToken(tokenBytes); System.out.println("ID: " + resultToken.getId()); System.out.println("Principal :" + resultToken.getPrincipal().getName()); System.out.print("Attribute : {"); for (Attribute attr : resultToken.getAttributes()) { System.out.print(attr.getName() + " "); } System.out.println("}"); System.out.println("CreationTime: " + resultToken.getCreationTime()); System.out.println("ExpiryTime: " + resultToken.getExpiryTime()); assertEquals(resultToken.getPrincipal().getName(), DEFAULT_PRINCIAL_NAME); }