Package org.apache.http.conn.socket
Class PlainConnectionSocketFactory
- java.lang.Object
-
- org.apache.http.conn.socket.PlainConnectionSocketFactory
-
- All Implemented Interfaces:
ConnectionSocketFactory
@Contract(threading=IMMUTABLE) public class PlainConnectionSocketFactory extends java.lang.Object implements ConnectionSocketFactory
The default class for creating plain (unencrypted) sockets.- Since:
- 4.3
-
-
Field Summary
Fields Modifier and Type Field Description static PlainConnectionSocketFactoryINSTANCE
-
Constructor Summary
Constructors Constructor Description PlainConnectionSocketFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.SocketconnectSocket(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.SocketcreateSocket(HttpContext context)Creates new, unconnected socket.static PlainConnectionSocketFactorygetSocketFactory()
-
-
-
Field Detail
-
INSTANCE
public static final PlainConnectionSocketFactory INSTANCE
-
-
Method Detail
-
getSocketFactory
public static PlainConnectionSocketFactory getSocketFactory()
-
createSocket
public java.net.Socket createSocket(HttpContext context) throws java.io.IOException
Description copied from interface:ConnectionSocketFactoryCreates new, unconnected socket. The socket should subsequently be passed toconnectSocketmethod.- Specified by:
createSocketin interfaceConnectionSocketFactory- Returns:
- a new socket
- Throws:
java.io.IOException- if an I/O error occurs while creating the socket
-
connectSocket
public 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.IOExceptionDescription copied from interface:ConnectionSocketFactoryConnects the socket to the target host with the given resolved remote address.- Specified by:
connectSocketin interfaceConnectionSocketFactory- Parameters:
connectTimeout- connect timeout.socket- the socket to connect, as obtained fromConnectionSocketFactory.createSocket(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
-
-