Interface ConnectionSocketFactory
-
- All Known Subinterfaces:
LayeredConnectionSocketFactory
- All Known Implementing Classes:
PlainConnectionSocketFactory,SSLConnectionSocketFactory
@Contract(threading=STATELESS) public interface ConnectionSocketFactoryA factory for creating and connecting connection sockets.- Since:
- 4.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.net.SocketconnectSocket(java.net.Socket socket, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context)Connects the socket to the target host with the given resolved remote address.java.net.SocketconnectSocket(org.apache.hc.core5.util.TimeValue connectTimeout, java.net.Socket socket, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.hc.core5.http.protocol.HttpContext context)Connects the socket to the target host with the given resolved remote address.default java.net.SocketcreateSocket(java.net.Proxy proxy, org.apache.hc.core5.http.protocol.HttpContext context)Creates new, unconnected socket via a proxy (generally SOCKS is expected).java.net.SocketcreateSocket(org.apache.hc.core5.http.protocol.HttpContext context)Creates new, unconnected socket.
-
-
-
Method Detail
-
createSocket
java.net.Socket createSocket(org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOExceptionCreates new, unconnected socket. The socket should subsequently be passed toconnectSocketmethod.- Throws:
java.io.IOException
-
createSocket
@Internal default java.net.Socket createSocket(java.net.Proxy proxy, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOExceptionCreates new, unconnected socket via a proxy (generally SOCKS is expected). The socket should subsequently be passed toconnectSocketmethod.- Throws:
java.io.IOException- Since:
- 5.2
-
connectSocket
java.net.Socket connectSocket(org.apache.hc.core5.util.TimeValue connectTimeout, java.net.Socket socket, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOExceptionConnects the socket to the target host with the given resolved remote address.- Parameters:
connectTimeout- connect timeout.socket- the socket to connect, as obtained fromcreateSocket(HttpContext).nullindicates 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, ornullfor any.context- the actual HTTP context.- Returns:
- the connected socket. The returned object may be different
from the
sockargument if this factory supports a layered protocol. - Throws:
java.io.IOException- if an I/O error occurs
-
connectSocket
default java.net.Socket connectSocket(java.net.Socket socket, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context) throws java.io.IOExceptionConnects the socket to the target host with the given resolved remote address.- Parameters:
socket- the socket to connect, as obtained fromcreateSocket(HttpContext).nullindicates 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, ornullfor any.connectTimeout- connect timeout.attachment- connect request attachment.context- the actual HTTP context.- Returns:
- the connected socket. The returned object may be different
from the
sockargument if this factory supports a layered protocol. - Throws:
java.io.IOException- if an I/O error occurs- Since:
- 5.2
-
-