Top Description Methods
org.apache.http.conn.socket

public Interface ConnectionSocketFactory

Known Direct Subinterfaces
org.apache.http.conn.socket.LayeredConnectionSocketFactory
Known Direct Implementers
org.apache.http.conn.socket.PlainConnectionSocketFactory
Imports
java.io.IOException, java.net.InetSocketAddress, .Socket, org.apache.http.HttpHost, org.apache.http.protocol.HttpContext

A factory for creating and connecting connection sockets.
Since
4.3

Method Summary

Modifier and TypeMethod and Description
public Socket

Returns:

the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.
connectSocket
(int
connect timeout.
connectTimeout
,
Socket
the socket to connect, as obtained from createSocket(HttpContext). null indicates that a new socket should be created and connected.
sock
,
HttpHost
target host as specified by the caller (end user).
host
,
InetSocketAddress
the resolved remote address to connect to.
remoteAddress
,
InetSocketAddress
the local address to bind the socket to, or null for any.
localAddress
,
HttpContext
the actual HTTP context.
context
)

Connects the socket to the target host with the given resolved remote address.

public Socket

Returns:

a new socket
createSocket
(HttpContext context)

Creates new, unconnected socket.

Method Detail

connectSocketback to summary
public Socket connectSocket(int connectTimeout, Socket sock, HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpContext context) throws IOException

Connects the socket to the target host with the given resolved remote address.

Parameters
connectTimeout:int

connect timeout.

sock:Socket

the socket to connect, as obtained from createSocket(HttpContext). null indicates that a new socket should be created and connected.

host:HttpHost

target host as specified by the caller (end user).

remoteAddress:InetSocketAddress

the resolved remote address to connect to.

localAddress:InetSocketAddress

the local address to bind the socket to, or null for any.

context:HttpContext

the actual HTTP context.

Returns:Socket

the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.

Exceptions
IOException:
if an I/O error occurs
createSocketback to summary
public Socket createSocket(HttpContext context) throws IOException

Creates new, unconnected socket. The socket should subsequently be passed to connectSocket method.

Returns:Socket

a new socket

Exceptions
IOException:
if an I/O error occurs while creating the socket