Package org.jivesoftware.openfire.net
Class SocketUtil
java.lang.Object
org.jivesoftware.openfire.net.SocketUtil
Utility class to generate Socket instances.
- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SystemProperty<Duration>A fixed delay for how long to wait before starting the next connection attempt, as defined in section 5 of RFC 8305 "Happy Eyeballs Version 2: Better Connectivity Using Concurrency".static final SystemProperty<Integer>The maximum amount of worker threads attempting to set up a socket connection to a target remote XMPP domain.static final SystemProperty<Duration>The time to wait for a response for the 'preferred IP family' after receiving a response for another family, as defined in section 3 of RFC 8305 "Happy Eyeballs Version 2: Better Connectivity Using Concurrency".static final SystemProperty<Duration>The maximum amount of time to wait for successful resolution of a host of a target domain. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateSocketToXmppDomain(String xmppDomain, int port) Creates a socket connection to an XMPP domain.
-
Field Details
-
CONNECTION_ATTEMPT_DELAY
A fixed delay for how long to wait before starting the next connection attempt, as defined in section 5 of RFC 8305 "Happy Eyeballs Version 2: Better Connectivity Using Concurrency".- See Also:
-
RESOLUTION_DELAY
The time to wait for a response for the 'preferred IP family' after receiving a response for another family, as defined in section 3 of RFC 8305 "Happy Eyeballs Version 2: Better Connectivity Using Concurrency".- See Also:
-
RESOLUTION_TIMEOUT
The maximum amount of time to wait for successful resolution of a host of a target domain.- See Also:
-
MAX_CONNECTION_CONCURRENCY
The maximum amount of worker threads attempting to set up a socket connection to a target remote XMPP domain. A value of '1' will effectively make 'Happy Eyeballs' impossible (as that requires concurrent connection attempts).- See Also:
-
-
Constructor Details
-
SocketUtil
public SocketUtil()
-
-
Method Details
-
createSocketToXmppDomain
Creates a socket connection to an XMPP domain. This implementation uses DNS SRV records to find a list of remote hosts for the XMPP domain (as implemented byDNSUtil.resolveXMPPDomain(String, int)). It then iteratively tries to create a socket connection to each of them, until one socket connection succeeds. Either the connected Socket instance is returned, or null if no connection could be established. Note that this method blocks while performing network IO. The timeout as defined byRemoteServerManager.getSocketTimeout()is observed.- Parameters:
xmppDomain- The XMPP domain to connect to.port- The port to connect to when DNS resolution fails.- Returns:
- a Socket instance that is connected, or null.
- See Also:
-