Interface Connection

    • Method Detail

      • getRemoteAddress

        InetSocketAddress getRemoteAddress()
        Gets the remote address of this connection.
        Returns:
        The remote address.
      • getConfiguration

        ConnectionConfiguration getConfiguration()
        Gets the configuration used to create this connection.
        Returns:
        The
      • isUsingAcknowledgements

        boolean isUsingAcknowledgements()
        Indicates whether this connection uses acknowledgements, e.g. by means of stream management or BOSH acks.
        Returns:
        If this connection uses acknowledgements.
      • open

        CompletionStage<Void> open​(SessionOpen sessionOpen)
        Opens the XML stream to the peer entity.
        Parameters:
        sessionOpen - The session open information.
        Returns:
        The completion stage, which is complete, if the session has been opened, i.e. the element has been sent.
      • send

        CompletionStage<Void> send​(StreamElement streamElement)
        Sends an element to the peer entity. This is basically a short cut for write + flush.
        Parameters:
        streamElement - The element.
        Returns:
        The future representing the send process and which allows to cancel it.
      • write

        CompletionStage<Void> write​(StreamElement streamElement)
        Writes the element to the stream without really sending it. It must be flushed.
        Parameters:
        streamElement - The element.
        Returns:
        The send future.
      • flush

        void flush()
        Flushes the connection. Any buffered elements written via write(StreamElement) are sent.
      • isSecure

        boolean isSecure()
        Indicates whether this connection is secured by TLS/SSL.
        Returns:
        True, if this connection is secured.
      • getStreamId

        String getStreamId()
        Gets the stream id of this connection.
        Returns:
        The stream id.
      • closeAsync

        CompletionStage<Void> closeAsync()
        Asynchronously closes the connection.

        Closing usually involves a round-trip with the peer on the XMPP layer first by sending a closing stream element, then waiting on the response and then closing the underlying transport layer.

        Implementations wait a maximum of 500ms for the XMPP level close.

        Returns:
        The future, which is complete, when the connection is closed.
        See Also:
        close()
      • closeAsync

        CompletionStage<Void> closeAsync​(StreamError streamError)
        Asynchronously closes the connection with a stream error.
        Parameters:
        streamError - The stream error, which is sent before closing the stream.
        Returns:
        The completion stage, which is complete, when the connection is closed.
        See Also:
        closeAsync()
      • closeFuture

        CompletionStage<Void> closeFuture()
        Returns a future which is complete, when the connection is closed.
        Returns:
        The close future.