Package rocks.xmpp.core.net.client
Class SocketConnector
- java.lang.Object
-
- rocks.xmpp.core.net.client.AbstractTcpConnector<Socket>
-
- rocks.xmpp.core.net.client.SocketConnector
-
- All Implemented Interfaces:
TransportConnector<TcpConnectionConfiguration>
public final class SocketConnector extends AbstractTcpConnector<Socket>
A TCP transport connector which usesSocket.This is the default connector for TCP based XMPP connections if none is defined.
However, you could explicitly set a custom socket factory in the configuration.
Sample Usage
TcpConnectionConfiguration tcpConfiguration = TcpConnectionConfiguration.builder() .hostname("localhost") .port(5222) .sslContext(sslContext) .channelEncryption(ChannelEncryption.REQUIRED) .connector(new SocketConnector(socketFactory)) .build();
-
-
Constructor Summary
Constructors Constructor Description SocketConnector()Creates a connector using a plain socket.SocketConnector(SocketFactory socketFactory)Creates a connector using a socket factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Connection>connect(XmppSession xmppSession, TcpConnectionConfiguration configuration, SessionOpen sessionOpen)Establishes a connection using the transport protocol specific configuration.
-
-
-
Constructor Detail
-
SocketConnector
public SocketConnector()
Creates a connector using a plain socket.
-
SocketConnector
public SocketConnector(SocketFactory socketFactory)
Creates a connector using a socket factory.- Parameters:
socketFactory- The socket factory.
-
-
Method Detail
-
connect
public final CompletableFuture<Connection> connect(XmppSession xmppSession, TcpConnectionConfiguration configuration, SessionOpen sessionOpen)
Description copied from interface:TransportConnectorEstablishes a connection using the transport protocol specific configuration.- Parameters:
xmppSession- The XMPP session which will be bound to the transport protocol.configuration- The connection configuration for the specific transport protocol.sessionOpen- The session open element.- Returns:
- A
CompletableFuturewhich returns an established (connected) connection on completion.
-
-