org.apache.http.impl.io
Class SSLSocketFactory

java.lang.Object
  extended by org.apache.http.impl.io.SSLSocketFactory
All Implemented Interfaces:
SecureSocketFactory, SocketFactory

public class SSLSocketFactory
extends java.lang.Object
implements SecureSocketFactory

.A wrapper class for the standard JSSE SSLSocketFactory.

Author:
Oleg Kalnichevski

Constructor Summary
SSLSocketFactory()
           
 
Method Summary
 java.net.Socket createSocket(java.net.Socket socket, java.lang.String host, int port, boolean autoClose)
          Returns a socket connected to the given host that is layered over an existing socket.
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpParams params)
          Attempts to get a new socket connection to the given host within the given time limit.
static SSLSocketFactory getSocketFactory()
          Gets an singleton instance of the SSLProtocolSocketFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSLSocketFactory

public SSLSocketFactory()
Method Detail

getSocketFactory

public static SSLSocketFactory getSocketFactory()
Gets an singleton instance of the SSLProtocolSocketFactory.

Returns:
a SSLProtocolSocketFactory

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress localAddress,
                                    int localPort,
                                    HttpParams params)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    ConnectTimeoutException
Attempts to get a new socket connection to the given host within the given time limit.

Specified by:
createSocket in interface SocketFactory
Parameters:
host - the host name/IP
port - the port on the host
localAddress - the local host name/IP to bind the socket to
localPort - the port on the local machine
params - Http connection parameters
Returns:
Socket a new socket
Throws:
java.io.IOException - if an I/O error occurs while creating the socket
java.net.UnknownHostException - if the IP address of the host cannot be determined
ConnectTimeoutException - if socket cannot be connected within the given time limit
Since:
3.0

createSocket

public java.net.Socket createSocket(java.net.Socket socket,
                                    java.lang.String host,
                                    int port,
                                    boolean autoClose)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Description copied from interface: SecureSocketFactory
Returns a socket connected to the given host that is layered over an existing socket. Used primarily for creating secure sockets through proxies.

Specified by:
createSocket in interface SecureSocketFactory
Parameters:
socket - the existing socket
host - the host name/IP
port - the port on the host
autoClose - a flag for closing the underling socket when the created socket is closed
Returns:
Socket a new socket
Throws:
java.io.IOException - if an I/O error occurs while creating the socket
java.net.UnknownHostException - if the IP address of the host cannot be determined


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.