This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


com.sun.mail.util
class SocketFetcher

com.sun.mail.util.SocketFetcher

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
startTLS(Socket socket)

          Start TLS on an existing socket.
static Socket
startTLS(Socket socket, Properties props, String prefix)

          Start TLS on an existing socket.
 

Method Detail

getSocket

public static Socket getSocket(String host,
                               int port,
                               Properties props,
                               String prefix)
                        throws IOException
Parameters:
host
port
props
prefix
Throws:
IOException

getSocket

public static Socket getSocket(String host,
                               int port,
                               Properties props,
                               String prefix,
                               boolean useSSL)
                        throws IOException
This method returns a Socket. Properties control the use of socket factories and other socket characteristics. The properties used are:

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.

Parameters:
host - The host to connect to
port - The port to connect to at the host
props - Properties object containing socket properties
prefix - Property name prefix, e.g., "mail.imap"
useSSL - use the SSL socket factory as the default
Throws:
IOException

startTLS

public static Socket startTLS(Socket socket)
                       throws IOException
Start TLS on an existing socket. Supports the "STARTTLS" command in many protocols. This version for compatibility possible third party code that might've used this API even though it shouldn't.

Parameters:
socket
Throws:
IOException

startTLS

public static Socket startTLS(Socket socket,
                              Properties props,
                              String prefix)
                       throws IOException
Start TLS on an existing socket. Supports the "STARTTLS" command in many protocols.

Parameters:
socket
props
prefix
Throws:
IOException


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention. The official Sun™ documentation can be found here at http://java.sun.com/products/javamail/javadocs/index.html.