@Immutable public class PlainConnectionSocketFactory extends java.lang.Object implements ConnectionSocketFactory
Modifier and Type | Field and Description |
---|---|
static PlainConnectionSocketFactory |
INSTANCE |
Constructor and Description |
---|
PlainConnectionSocketFactory() |
Modifier and Type | Method and Description |
---|---|
java.net.Socket |
connectSocket(int connectTimeout,
java.net.Socket socket,
HttpHost host,
java.net.InetSocketAddress remoteAddress,
java.net.InetSocketAddress localAddress,
HttpContext context)
Connects the socket to the target host with the given resolved remote address.
|
java.net.Socket |
createSocket(HttpContext context)
Creates new, unconnected socket.
|
static PlainConnectionSocketFactory |
getSocketFactory() |
public static final PlainConnectionSocketFactory INSTANCE
public static PlainConnectionSocketFactory getSocketFactory()
public java.net.Socket createSocket(HttpContext context) throws java.io.IOException
ConnectionSocketFactory
connectSocket
method.createSocket
in interface ConnectionSocketFactory
java.io.IOException
- if an I/O error occurs while creating the socketpublic java.net.Socket connectSocket(int connectTimeout, java.net.Socket socket, HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, HttpContext context) throws java.io.IOException
ConnectionSocketFactory
connectSocket
in interface ConnectionSocketFactory
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.sock
argument if this factory supports
a layered protocol.java.io.IOException
- if an I/O error occurs