public abstract class Connection extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
abstract void |
connect(rocks.xmpp.addr.Jid from,
String namespace,
Consumer<rocks.xmpp.addr.Jid> onStreamOpened)
Connects to the server and provides an optional 'from' attribute.
|
String |
getHostname()
Gets the hostname, which is used for the connection.
|
int |
getPort()
Gets the port, which is used for the connection.
|
Proxy |
getProxy()
Gets the proxy.
|
abstract String |
getStreamId()
Gets the stream id of this connection.
|
abstract boolean |
isSecure()
Indicates whether this connection is secured by TLS/SSL.
|
abstract boolean |
isUsingAcknowledgements()
Indicates, whether this connection is using acknowledgements.
|
abstract CompletableFuture<Void> |
send(StreamElement streamElement)
Sends an element over this connection.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic final String getHostname()
public final int getPort()
public final Proxy getProxy()
public abstract CompletableFuture<Void> send(StreamElement streamElement)
streamElement - The element.public abstract void connect(rocks.xmpp.addr.Jid from,
String namespace,
Consumer<rocks.xmpp.addr.Jid> onStreamOpened)
throws IOException
from - The 'from' attribute.namespace - The content namespace, e.g. "jabber:client".onStreamOpened - The callback which gets notified when the stream gets opened, i.e. when the server has responded with a stream header. The parameter of the consumer is the stream id.IOException - If no connection could be established, e.g. due to unknown host.public abstract boolean isSecure()
public abstract String getStreamId()
public abstract boolean isUsingAcknowledgements()
TCP and WebSocket connections use XEP-0198: Stream Management to acknowledge stanzas.
BOSH connections use another mechanism for acknowledgements, described in XEP-0124 § 9. Acknowledgements.
Copyright © 2014–2016 XMPP.rocks. All rights reserved.