Class STUN

    • Constructor Detail

      • STUN

        public STUN()
        Creates a STUN IQ.
    • Method Detail

      • getServers

        public java.util.List<STUN.StunServerAddressgetServers()
        Get a list of STUN Servers recommended by the Server.
        Returns:
        the list of STUN servers
      • getPublicIp

        public java.lang.String getPublicIp()
        Get Public Ip returned from the XMPP server.
        Returns:
        the public IP
      • getSTUNServer

        public static STUN getSTUNServer​(XMPPConnection connection)
                                  throws SmackException.NotConnectedException,
                                         java.lang.InterruptedException
        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.
        Parameters:
        connection - TODO javadoc me please
        Returns:
        the STUN server address
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • serviceAvailable

        public static boolean serviceAvailable​(XMPPConnection connection)
                                        throws XMPPException,
                                               SmackException,
                                               java.lang.InterruptedException
        Check if the server support STUN Service.
        Parameters:
        connection - the connection
        Returns:
        true if the server support STUN
        Throws:
        SmackException - if Smack detected an exceptional situation.
        XMPPException - if an XMPP protocol error was received.
        java.lang.InterruptedException - if the calling thread was interrupted.