public final class SocketConnection extends AbstractConnection implements TcpBinding
The default TCP socket connection as described in TCP Binding.
If no hostname is set (null or empty) the connection tries to resolve the hostname via an SRV DNS lookup.
This class is unconditionally thread-safe.
| Constructor and Description |
|---|
SocketConnection(java.net.Socket socket,
XmppSession xmppSession,
TcpConnectionConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<java.lang.Void> |
closeFuture() |
void |
compressConnection(java.lang.String method,
java.lang.Runnable onSuccess) |
void |
flush() |
java.net.InetSocketAddress |
getRemoteAddress() |
boolean |
isSecure() |
boolean |
isUsingAcknowledgements() |
java.util.concurrent.CompletionStage<java.lang.Void> |
open(SessionOpen sessionOpen) |
void |
secureConnection()
This method is called from the reader thread.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
send(StreamElement element) |
java.lang.String |
toString() |
java.util.concurrent.CompletableFuture<java.lang.Void> |
write(StreamElement streamElement) |
close, closeAsync, closeAsync, getConfiguration, getStreamIdequals, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, closeAsync, closeAsync, getConfiguration, getStreamIdpublic SocketConnection(java.net.Socket socket,
XmppSession xmppSession,
TcpConnectionConfiguration configuration)
public final java.util.concurrent.CompletionStage<java.lang.Void> open(SessionOpen sessionOpen)
open in interface Connectionpublic boolean isSecure()
isSecure in interface Connectionpublic void secureConnection()
throws java.io.IOException,
java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException
This method is called from the reader thread. Because it accesses shared data (socket, outputStream, inputStream) it should be synchronized.
secureConnection in interface TcpBindingjava.io.IOExceptionjava.security.cert.CertificateExceptionjava.security.NoSuchAlgorithmExceptionpublic void compressConnection(java.lang.String method,
java.lang.Runnable onSuccess)
throws java.lang.Exception
compressConnection in interface TcpBindingjava.lang.Exceptionpublic final java.util.concurrent.CompletableFuture<java.lang.Void> send(StreamElement element)
send in interface Connectionpublic final java.util.concurrent.CompletableFuture<java.lang.Void> write(StreamElement streamElement)
write in interface Connectionpublic final void flush()
flush in interface Connectionpublic final java.util.concurrent.CompletionStage<java.lang.Void> closeFuture()
closeFuture in interface Connectionpublic final java.net.InetSocketAddress getRemoteAddress()
getRemoteAddress in interface Connectionpublic final boolean isUsingAcknowledgements()
isUsingAcknowledgements in interface ConnectionisUsingAcknowledgements in class AbstractConnectionpublic final java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2014–2018 XMPP.rocks. All rights reserved.