code: public static JobService connect(String host, String username,
        String password) throws RemoteException, NotBoundException,
        LoginException, ProtocolVersionException {
      Registry registry = LocateRegistry.getRegistry(host, DEFAULT_PORT);
      AuthenticationService auth = (AuthenticationService) registry.lookup("AuthenticationService");
      return auth.authenticate(username, password, PROTOCOL_VERSION_ID);
    }
docs: Connects to a JDCP server.
  @param host The host name of the server to send the job to.
  @param username The user name to use to authenticate with the server.
  @param password The password to use to authenticate with the server.
  @return The <code>JobService</code> to use to communicate with the
  server.
  @throws RemoteException If a failure occurs in attempting to communicate
  with the server.
  @throws LoginException If the login attempt fails.
  @throws NotBoundException If the <code>AuthenticationService</code>
  could not be found at the server.
  @throws ProtocolVersionException If this client is incompatible with the
  server.