Package org.apache.http.conn.socket
Interface ConnectionSocketFactory
-
- All Known Subinterfaces:
LayeredConnectionSocketFactory
- All Known Implementing Classes:
PlainConnectionSocketFactory
,SSLConnectionSocketFactory
,SSLSocketFactory
public interface ConnectionSocketFactory
A factory for creating and connecting connection sockets.- Since:
- 4.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.Socket
connectSocket(int connectTimeout, java.net.Socket sock, 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.
-
-
-
Method Detail
-
createSocket
java.net.Socket createSocket(HttpContext context) throws java.io.IOException
Creates new, unconnected socket. The socket should subsequently be passed toconnectSocket
method.- Returns:
- a new socket
- Throws:
java.io.IOException
- if an I/O error occurs while creating the socket
-
connectSocket
java.net.Socket connectSocket(int connectTimeout, java.net.Socket sock, HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, HttpContext context) throws java.io.IOException
Connects the socket to the target host with the given resolved remote address.- Parameters:
connectTimeout
- connect timeout.sock
- the socket to connect, as obtained fromcreateSocket(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, ornull
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:
java.io.IOException
- if an I/O error occurs
-
-