@Test
@TestDir
public void testAuthenticate() throws Exception {

  String dir = TestDirHelper.getTestDir().getAbsolutePath();
  Configuration httpfsConf = new Configuration(false);
  HttpFSServerWebApp server =
    new HttpFSServerWebApp(dir, dir, dir, dir, httpfsConf);
  server.setAuthority(new InetSocketAddress(InetAddress.getLocalHost(),
                                            14000));
  AuthenticationHandler handler =
    new HttpFSKerberosAuthenticationHandlerForTesting();
  try {
    server.init();
    handler.init(null);
    testValidDelegationToken(handler);
    testInvalidDelegationToken(handler);
  } finally {
    if (handler != null) {
      handler.destroy();
    }
  server.destroy();
  }
}