org.apache.http.conn.socket
Class PlainSocketFactory

java.lang.Object
  extended by org.apache.http.conn.socket.PlainSocketFactory
All Implemented Interfaces:
ConnectionSocketFactory

@Immutable
public class PlainSocketFactory
extends Object
implements ConnectionSocketFactory

The default class for creating plain (unencrypted) sockets.

Since:
4.3

Field Summary
static PlainSocketFactory INSTANCE
           
 
Constructor Summary
PlainSocketFactory()
           
 
Method Summary
 Socket connectSocket(int connectTimeout, Socket socket, HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpContext context)
          Connects a socket to the target host with the given resolved remote address.
 Socket createSocket(HttpContext context)
          Creates new, unconnected socket.
static PlainSocketFactory getSocketFactory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final PlainSocketFactory INSTANCE
Constructor Detail

PlainSocketFactory

public PlainSocketFactory()
Method Detail

getSocketFactory

public static PlainSocketFactory getSocketFactory()

createSocket

public Socket createSocket(HttpContext context)
                    throws IOException
Description copied from interface: ConnectionSocketFactory
Creates new, unconnected socket. The socket should subsequently be passed to ConnectionSocketFactory.connectSocket(int, Socket, HttpHost, InetSocketAddress, InetSocketAddress, HttpContext).

Specified by:
createSocket in interface ConnectionSocketFactory
Returns:
a new socket
Throws:
IOException - if an I/O error occurs while creating the socket

connectSocket

public Socket connectSocket(int connectTimeout,
                            Socket socket,
                            HttpHost host,
                            InetSocketAddress remoteAddress,
                            InetSocketAddress localAddress,
                            HttpContext context)
                     throws IOException,
                            ConnectTimeoutException
Description copied from interface: ConnectionSocketFactory
Connects a socket to the target host with the given resolved remote address.

Specified by:
connectSocket in interface ConnectionSocketFactory
Parameters:
connectTimeout - connect timeout.
socket - the socket to connect, as obtained from ConnectionSocketFactory.createSocket(HttpContext). null indicates that a new socket should be created and connected.
host - target host as specified by the caller (end user).
remoteAddress - the resolved remote address to connect to.
localAddress - the local address to bind the socket to, or null for any.
context - the actual HTTP context.
Returns:
the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.
Throws:
IOException - if an I/O error occurs
ConnectTimeoutException - if the socket cannot be connected within the time limit defined in the params


Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.