Package rocks.xmpp.websocket.net.client
Class HttpClientWebSocketConnector
- java.lang.Object
-
- rocks.xmpp.websocket.net.client.HttpClientWebSocketConnector
-
- All Implemented Interfaces:
TransportConnector<WebSocketConnectionConfiguration>
public final class HttpClientWebSocketConnector extends Object
A WebSocket transport connector which usesWebSocket
.This is the default connector for WebSocket based XMPP connections if none is defined.
However, you could still explicitly set it as shown below.
Sample Usage
WebSocketConnectionConfiguration webSocketConfiguration = WebSocketConnectionConfiguration.builder() .hostname("localhost") .port(443) .sslContext(sslContext) .channelEncryption(ChannelEncryption.DIRECT) .connector(new HttpClientWebSocketConnector()) .build();
Hostname Verification
Please note that the WebSocket API does not allow to set a hostname verifier. To disable hostname verification you have to set the system property:
-Djdk.internal.httpclient.disableHostnameVerification
-
-
Constructor Summary
Constructors Constructor Description HttpClientWebSocketConnector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Connection>
connect(XmppSession xmppSession, WebSocketConnectionConfiguration configuration, SessionOpen sessionOpen)
Establishes a connection using the transport protocol specific configuration.
-
-
-
Method Detail
-
connect
public final CompletableFuture<Connection> connect(XmppSession xmppSession, WebSocketConnectionConfiguration configuration, SessionOpen sessionOpen)
Description copied from interface:TransportConnector
Establishes 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
CompletableFuture
which returns an established (connected) connection on completion.
-
-