Module org.newsclub.net.unix
Package org.newsclub.net.unix
Class AFSocketFactory.FixedAddressSocketFactory
java.lang.Object
javax.net.SocketFactory
org.newsclub.net.unix.AFSocketFactory<AFSocketAddress>
org.newsclub.net.unix.AFSocketFactory.FixedAddressSocketFactory
- All Implemented Interfaces:
AFSocketAddressFromHostname<AFSocketAddress>
- Enclosing class:
AFSocketFactory<A extends AFSocketAddress>
public static final class AFSocketFactory.FixedAddressSocketFactory
extends AFSocketFactory<AFSocketAddress>
A socket factory that always connects to a fixed socket address, no matter what.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.newsclub.net.unix.AFSocketFactory
AFSocketFactory.FixedAddressSocketFactory -
Constructor Summary
ConstructorsConstructorDescriptionFixedAddressSocketFactory(SocketAddress address) Creates aAFSocketFactory.FixedAddressSocketFactory. -
Method Summary
Modifier and TypeMethodDescriptionaddressFromHost(String host, int port) Translates a "host" string (and port) to anAFSocketAddress.protected SocketconnectTo(AFSocketAddress addr) Creates a newAFSocket, connected to the given address.booleanisHostnameSupported(String host) Checks whether the given hostname is supported by this socket factory.Methods inherited from class org.newsclub.net.unix.AFSocketFactory
createSocket, createSocket, createSocket, createSocket, isInetAddressSupportedMethods inherited from class javax.net.SocketFactory
getDefault
-
Constructor Details
-
FixedAddressSocketFactory
Creates aAFSocketFactory.FixedAddressSocketFactory.- Parameters:
address- The address to use for all connections.
-
-
Method Details
-
isHostnameSupported
Description copied from interface:AFSocketAddressFromHostnameChecks whether the given hostname is supported by this socket factory. If not, calls to createSocket will cause aSocketException.- Parameters:
host- The host to check.- Returns:
trueif supported.
-
addressFromHost
Description copied from interface:AFSocketAddressFromHostnameTranslates a "host" string (and port) to anAFSocketAddress.- Parameters:
host- The hostnameport- The port, or 0.- Returns:
- The
AFSocketAddress - Throws:
SocketException- If there was a problem converting the hostname
-
createSocket
- Specified by:
createSocketin classAFSocketFactory<AFSocketAddress>- Throws:
SocketException
-
connectTo
Description copied from class:AFSocketFactoryCreates a newAFSocket, connected to the given address.- Specified by:
connectToin classAFSocketFactory<AFSocketAddress>- Parameters:
addr- The address to connect to.- Returns:
- The socket instance.
- Throws:
IOException- on error.
-