code: public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException,
                      SmackException, IOException, InterruptedException {
          if (!config.allowNullOrEmptyUsername) {
              StringUtils.requireNotNullNorEmpty(username, "Username must not be null nor empty");
          }
          throwNotConnectedExceptionIfAppropriate("Did you call connect() before login()?");
          throwAlreadyLoggedInExceptionIfAppropriate();
          usedUsername = username != null ? username.toString() : null;
          usedPassword = password;
          usedResource = resource;
          loginInternal(usedUsername, usedPassword, usedResource);
      }
docs: Login with the given username (authorization identity). You may omit the password if a callback handler is used.
  If resource is null, then the server will generate one.
  
  @param username
  @param password
  @param resource
  @throws XMPPException
  @throws SmackException
  @throws IOException
  @throws InterruptedException
  @see #login