code: public boolean isFriend(Jid provisioningServer, BareJid friendInQuestion) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
          LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(provisioningServer);
          if (cache != null && cache.containsKey(friendInQuestion)) {
              // We hit a cached negative isFriend response for this provisioning server.
              return false;
          }
  
          IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion);
          iotIsFriend.setTo(provisioningServer);
          IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow();
          assert (response.getJid().equals(friendInQuestion));
          boolean isFriend = response.getIsFriendResult();
          if (!isFriend) {
              // Cache the negative is friend response.
              if (cache == null) {
                  cache = new LruCache<>(1024);
                  negativeFriendshipRequestCache.put(provisioningServer, cache);
              }
              cache.put(friendInQuestion, null);
          }
          return isFriend;
      }
docs: As the given provisioning server is the given JID is a friend.
  
  @param provisioningServer the provisioning server to ask.
  @param friendInQuestion the JID to ask about.
  @return <code>true</code> if the JID is a friend, <code>false</code> otherwise.
  @throws NoResponseException
  @throws XMPPErrorException
  @throws NotConnectedException
  @throws InterruptedException