| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class SocketFetcher extends Object
This class is used to get Sockets. Depending on the arguments passed it will either return a plain java.net.Socket or dynamically load the SocketFactory class specified in the classname param and return a socket created by that SocketFactory.
Method Summary | |
---|---|
static Socket |
getSocket(String host, int port, Properties props, String prefix) |
static Socket |
getSocket(String host, int port, Properties props, String prefix, boolean useSSL) This method returns a Socket. |
static Socket |
Start TLS on an existing socket. |
static Socket |
startTLS(Socket socket, Properties props, String prefix) Start TLS on an existing socket. |
Method Detail |
---|
public static Socket getSocket(String host, int port, Properties props, String prefix) throws IOException
host
port
props
prefix
IOException
public static Socket getSocket(String host, int port, Properties props, String prefix, boolean useSSL) throws IOException
If the socketFactory.class property isn't set, the socket returned is an instance of java.net.Socket connected to the given host and port. If the socketFactory.class property is set, it is expected to contain a fully qualified classname of a javax.net.SocketFactory subclass. In this case, the class is dynamically instantiated and a socket created by that SocketFactory is returned.
If the socketFactory.fallback property is set to false, don't fall back to using regular sockets if the socket factory fails.
The socketFactory.port specifies a port to use when connecting through the socket factory. If unset, the port argument will be used.
If the connectiontimeout property is set, we use a separate thread to make the connection so that we can timeout that connection attempt.
If the timeout property is set, it is used to set the socket timeout.
If the localaddress property is set, it's used as the local address to bind to. If the localport property is also set, it's used as the local port number to bind to.
host
- The host to connect toport
- The port to connect to at the hostprops
- Properties object containing socket propertiesprefix
- Property name prefix, e.g., "mail.imap"useSSL
- use the SSL socket factory as the defaultIOException
public static Socket startTLS(Socket socket) throws IOException
socket
IOException
public static Socket startTLS(Socket socket, Properties props, String prefix) throws IOException
socket
props
prefix
IOException
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |