@Override
    public AuthenticationProtos.WhoAmIResponse whoAmI(RpcController controller,
      AuthenticationProtos.WhoAmIRequest request) throws ServiceException {
      LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName().orElse(null));
      // Ignore above passed in controller -- it is always null
      ServerRpcController serverController = new ServerRpcController();
      BlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback =
        new BlockingRpcCallback<>();
      whoAmI(null, request, callback);
      try {
        serverController.checkFailed();
        return callback.get();
      } catch (IOException ioe) {
        throw new ServiceException(ioe);
      }
    }
Basic server process for RPC authentication testing
hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java