Module org.newsclub.net.unix
Package org.newsclub.net.unix
Class AFSocketFactory<A extends AFSocketAddress>
java.lang.Object
javax.net.SocketFactory
org.newsclub.net.unix.AFSocketFactory<A>
- Type Parameters:
 A- The supported address type.
- All Implemented Interfaces:
 AFSocketAddressFromHostname<A>
- Direct Known Subclasses:
 AFSocketFactory.FixedAddressSocketFactory,AFSYSTEMSocketFactory,AFTIPCSocketFactory,AFUNIXSocketFactory,AFVSOCKSocketFactory
public abstract class AFSocketFactory<A extends AFSocketAddress>
extends SocketFactory
implements AFSocketAddressFromHostname<A>
The base for a SocketFactory that connects to UNIX sockets.
 Typically, the "hostname" is used as a reference to a socketFile on the file system. The actual
 mapping is left to the implementor.
- See Also:
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA socket factory that always connects to a fixed socket address, no matter what. - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAFSocketFactory(Class<? extends AFSocketAddress> socketAddressClass) Creates a new socket factory instance. - 
Method Summary
Modifier and TypeMethodDescriptionprotected abstract SocketCreates a newAFSocket, connected to the given address.abstract Socketfinal SocketcreateSocket(String host, int port) final SocketcreateSocket(String host, int port, InetAddress localHost, int localPort) final SocketcreateSocket(InetAddress address, int port) final SocketcreateSocket(InetAddress address, int port, InetAddress localAddress, int localPort) protected final booleanisInetAddressSupported(InetAddress address) Checks whether the givenInetAddressis supported by this socket factory.Methods inherited from class javax.net.SocketFactory
getDefaultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.newsclub.net.unix.AFSocketAddressFromHostname
addressFromHost, isHostnameSupported 
- 
Constructor Details
- 
AFSocketFactory
Creates a new socket factory instance.- Parameters:
 socketAddressClass- The AFSocketAddress subclass.
 
 - 
 - 
Method Details
- 
isInetAddressSupported
Checks whether the givenInetAddressis supported by this socket factory. If not, calls to createSocket will cause aSocketException. By default, this only checks the hostname part of the address viaAFSocketAddressFromHostname.isHostnameSupported(String).- Parameters:
 address- The address to check.- Returns:
 trueif supported.
 - 
createSocket
- Overrides:
 createSocketin classSocketFactory- Throws:
 SocketException
 - 
connectTo
Creates a newAFSocket, connected to the given address.- Parameters:
 addr- The address to connect to.- Returns:
 - The socket instance.
 - Throws:
 IOException- on error.
 - 
createSocket
- Specified by:
 createSocketin classSocketFactory- Throws:
 IOException
 - 
createSocket
public final Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException - Specified by:
 createSocketin classSocketFactory- Throws:
 IOException
 - 
createSocket
- Specified by:
 createSocketin classSocketFactory- Throws:
 IOException
 - 
createSocket
public final Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException - Specified by:
 createSocketin classSocketFactory- Throws:
 IOException
 
 -