@Test
  public void testOnlyToken() throws Exception {
    User user =
      User.createUserForTesting(TEST_UTIL.getConfiguration(), "no_krb_user", new String[0]);
    for (Token<? extends TokenIdentifier> token : User.getCurrent().getUGI().getCredentials()
      .getAllTokens()) {
      user.getUGI().addToken(token);
    }
    user.getUGI().doAs(new PrivilegedExceptionAction<Void>() {

      @Override
      public Void run() throws Exception {
        testToken();
        return null;
      }
    });
  }
Confirm that we can connect to cluster successfully when there is only token present, i.e, no
kerberos ticket
hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestGenerateDelegationToken.java