Class UnixDomainSocketFactory
java.lang.Object
org.apache.hc.client5.http.socket.UnixDomainSocketFactory
A factory for Unix domain sockets.
This implementation supports both the JDK16+ standard library implementation (JEP 380) and the JUnixSocket library. It will automatically detect which implementation is available and use it; if both are available, the standard library implementation is preferred.
- Since:
- 5.6
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final UnixDomainSocketFactory.Implementationprivate static final UnixDomainSocketFactoryDefault instance ofUnixDomainSocketFactory.private static final Stringprivate static final Stringprivate static final Stringprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconnectSocket(Socket socket, Path socketPath, org.apache.hc.core5.util.TimeValue connectTimeout) createSocketAddress(Path socketPath) private static UnixDomainSocketFactory.Implementationstatic UnixDomainSocketFactoryGets the singleton instance ofUnixDomainSocketFactory.static booleanChecks if Unix Domain Socket support is available.
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
JDK_UNIX_SOCKET_ADDRESS_CLASS
- See Also:
-
JUNIXSOCKET_SOCKET_CLASS
- See Also:
-
JUNIXSOCKET_ADDRESS_CLASS
- See Also:
-
IMPLEMENTATION
-
INSTANCE
Default instance ofUnixDomainSocketFactory.
-
-
Constructor Details
-
UnixDomainSocketFactory
public UnixDomainSocketFactory()
-
-
Method Details
-
detectImplementation
-
isAvailable
public static boolean isAvailable()Checks if Unix Domain Socket support is available.- Returns:
- true if Unix Domain Socket support is available, false otherwise
-
getSocketFactory
Gets the singleton instance ofUnixDomainSocketFactory.- Returns:
- the singleton instance
-
createSocketAddress
-
createSocket
- Throws:
IOException
-
connectSocket
public Socket connectSocket(Socket socket, Path socketPath, org.apache.hc.core5.util.TimeValue connectTimeout) throws IOException - Throws:
IOException
-