code: public void checkAuthentication() throws ConnectionException {
          IServices services = new Services(createMetaModel(),
          	populateHeaders(new V1APIConnector(getApplicationURL() + "rest-1.v1/",
                          username, password, ApiClientInternals.getProxyProvider(proxySettings))));
          Oid loggedin;
  
          try {
              loggedin = services.getLoggedIn();
          } catch (Exception ex) {
              throw new ConnectionException(
                      "Unable to log in. Incorrect username or password.", ex);
          }
  
          if (loggedin.isNull()) {
              throw new ConnectionException(
                      "Unable to retrieve logged in member.");
          }
      }
docs: Checking authentication.
  
  @throws ConnectionException if user name or password is not correct or
  unable to retrieve logged in member.