code: public void preApprove(BareJid user) throws NotLoggedInException, NotConnectedException, InterruptedException, FeatureNotSupportedException {
          final XMPPConnection connection = connection();
          if (!isSubscriptionPreApprovalSupported()) {
              throw new FeatureNotSupportedException("Pre-approving");
          }
  
          Presence presencePacket = new Presence(Presence.Type.subscribed);
          presencePacket.setTo(user);
          connection.sendStanza(presencePacket);
      }
docs: Pre-approve user presence subscription.
  
  @param user the user. (e.g. johndoe@jabber.org)
  @throws NotLoggedInException if not logged in.
  @throws NotConnectedException
  @throws InterruptedException
  @throws FeatureNotSupportedException if pre-approving is not supported.
  @since 4.2