Package rocks.xmpp.core.net.client
Class SocketConnection
- java.lang.Object
-
- rocks.xmpp.core.net.AbstractConnection
-
- rocks.xmpp.core.net.TcpConnection
-
- rocks.xmpp.core.net.client.SocketConnection
-
- All Implemented Interfaces:
AutoCloseable,Connection,StreamHandler
public final class SocketConnection extends TcpConnection
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.
- See Also:
- 3. TCP Binding
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>closeFuture()voidcompressConnection(String method, Runnable onSuccess)voidflush()InetSocketAddressgetRemoteAddress()booleanisSecure()booleanisUsingAcknowledgements()CompletionStage<Void>open(SessionOpen sessionOpen)voidsecureConnection()This method is called from the reader thread.CompletableFuture<Void>send(StreamElement element)StringtoString()CompletableFuture<Void>write(StreamElement streamElement)-
Methods inherited from class rocks.xmpp.core.net.AbstractConnection
close, closeAsync, closeAsync, getConfiguration, getStreamId, handleElement, isClosed
-
-
-
-
Method Detail
-
open
public final CompletionStage<Void> open(SessionOpen sessionOpen)
-
isSecure
public boolean isSecure()
-
secureConnection
public void secureConnection() throws IOException, CertificateException, NoSuchAlgorithmExceptionThis method is called from the reader thread. Because it accesses shared data (socket, outputStream, inputStream) it should be synchronized.- Specified by:
secureConnectionin classTcpConnection- Throws:
IOExceptionCertificateExceptionNoSuchAlgorithmException
-
compressConnection
public void compressConnection(String method, Runnable onSuccess) throws Exception
- Specified by:
compressConnectionin classTcpConnection- Throws:
Exception
-
send
public final CompletableFuture<Void> send(StreamElement element)
-
write
public final CompletableFuture<Void> write(StreamElement streamElement)
-
flush
public final void flush()
-
closeFuture
public final CompletionStage<Void> closeFuture()
-
getRemoteAddress
public final InetSocketAddress getRemoteAddress()
-
isUsingAcknowledgements
public final boolean isUsingAcknowledgements()
- Specified by:
isUsingAcknowledgementsin interfaceConnection- Overrides:
isUsingAcknowledgementsin classAbstractConnection
-
-