code: @SuppressWarnings("deprecation")
      public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException {
  
          if (!connection.isConnected()) {
              return null;
          }
  
          STUN stunPacket = new STUN();
          stunPacket.setTo(DOMAIN + "." + connection.getXMPPServiceDomain());
  
          StanzaCollector collector = connection.createStanzaCollectorAndSend(stunPacket);
  
          STUN response = collector.nextResult();
  
          // Cancel the collector.
          collector.cancel();
  
          return response;
      }
docs: Get a new STUN Server Address and port from the server.
  If a error occurs or the server don't support STUN Service, null is returned.
  
  @param connection
  @return the STUN server address
  @throws NotConnectedException
  @throws InterruptedException