### Question:
HttpFSKerberosAuthenticationHandler extends KerberosAuthenticationHandler { @Override public AuthenticationToken authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException, AuthenticationException { AuthenticationToken token; String delegationParam = request.getParameter(HttpFSKerberosAuthenticator.DELEGATION_PARAM); if (delegationParam != null) { try { Token<DelegationTokenIdentifier> dt = new Token<DelegationTokenIdentifier>(); dt.decodeFromUrlString(delegationParam); DelegationTokenManager tokenManager = HttpFSServerWebApp.get().get(DelegationTokenManager.class); UserGroupInformation ugi = tokenManager.verifyToken(dt); final String shortName = ugi.getShortUserName(); token = new AuthenticationToken(shortName, ugi.getUserName(), getType()); token.setExpires(0); } catch (Throwable ex) { throw new AuthenticationException("Could not verify DelegationToken, " + ex.toString(), ex); } } else { token = super.authenticate(request, response); } return token; }  @Override String getType(); @Override @SuppressWarnings("unchecked") boolean managementOperation(AuthenticationToken token,
      HttpServletRequest request, HttpServletResponse response); @Override AuthenticationToken authenticate(HttpServletRequest request,
                                          HttpServletResponse response); static final String TYPE; }### Answer:
@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(); } }