public interface Connection
extends java.lang.AutoCloseable
Represents a bi-directional XMPP connection.
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.util.concurrent.CompletionStage<java.lang.Void> |
closeAsync()
Asynchronously closes the connection.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
closeAsync(StreamError streamError)
Asynchronously closes the connection with a stream error.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
closeFuture()
Returns a future which is complete, when the connection is closed.
|
void |
flush()
Flushes the connection.
|
ConnectionConfiguration |
getConfiguration()
Gets the configuration used to create this connection.
|
java.net.InetSocketAddress |
getRemoteAddress()
Gets the remote address of this connection.
|
java.lang.String |
getStreamId()
Gets the stream id of this connection.
|
boolean |
isSecure()
Indicates whether this connection is secured by TLS/SSL.
|
boolean |
isUsingAcknowledgements()
Indicates whether this connection uses acknowledgements, e.g. by means of stream management or BOSH acks.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
open(SessionOpen sessionOpen)
Opens the XML stream to the peer entity.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
send(StreamElement streamElement)
Sends an element to the peer entity.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
write(StreamElement streamElement)
Writes the element to the stream without really sending it.
|
java.net.InetSocketAddress getRemoteAddress()
Gets the remote address of this connection.
ConnectionConfiguration getConfiguration()
Gets the configuration used to create this connection.
boolean isUsingAcknowledgements()
Indicates whether this connection uses acknowledgements, e.g. by means of stream management or BOSH acks.
java.util.concurrent.CompletionStage<java.lang.Void> open(SessionOpen sessionOpen)
Opens the XML stream to the peer entity.
sessionOpen
- The session open information.java.util.concurrent.CompletionStage<java.lang.Void> send(StreamElement streamElement)
streamElement
- The element.java.util.concurrent.CompletionStage<java.lang.Void> write(StreamElement streamElement)
Writes the element to the stream without really sending it. It must be flushed.
streamElement
- The element.void flush()
Flushes the connection. Any buffered elements written via write(StreamElement)
are sent.
boolean isSecure()
Indicates whether this connection is secured by TLS/SSL.
java.lang.String getStreamId()
Gets the stream id of this connection.
java.util.concurrent.CompletionStage<java.lang.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.
close()
java.util.concurrent.CompletionStage<java.lang.Void> closeAsync(StreamError streamError)
Asynchronously closes the connection with a stream error.
closeAsync()
java.util.concurrent.CompletionStage<java.lang.Void> closeFuture()
Returns a future which is complete, when the connection is closed.
void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
Copyright © 2014–2019 XMPP.rocks. All rights reserved.