code: @Override
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
      for (Callback callback : callbacks) {
        if (callback instanceof NameCallback) {
          ((NameCallback) callback).setName(username);
        } else if (callback instanceof PasswordCallback) {
          ((PasswordCallback) callback).setPassword(password.toCharArray());
        } else {
          throw new AuthenticationException("SASLClient requested unsupported callback: " + callback);
        }
      }
    }
docs: Handles the SASL defined callbacks to set user and password (the {@link CallbackHandler} interface).