public class DefaultClientConnectionOperator extends java.lang.Object implements ClientConnectionOperator
ClientConnectionOperator
. It uses
a SchemeRegistry
to look up SocketFactory
objects.
The following parameters can be used to customize the behavior of this class:
Modifier and Type | Field and Description |
---|---|
protected SchemeRegistry |
schemeRegistry
The scheme registry for looking up socket factories.
|
Constructor and Description |
---|
DefaultClientConnectionOperator(SchemeRegistry schemes)
Creates a new client connection operator for the given scheme registry.
|
Modifier and Type | Method and Description |
---|---|
OperatedClientConnection |
createConnection()
Creates a new connection that can be operated.
|
void |
openConnection(OperatedClientConnection conn,
HttpHost target,
java.net.InetAddress local,
HttpContext context,
HttpParams params)
Opens a connection to the given target host.
|
protected void |
prepareSocket(java.net.Socket sock,
HttpContext context,
HttpParams params)
Performs standard initializations on a newly created socket.
|
void |
updateSecureConnection(OperatedClientConnection conn,
HttpHost target,
HttpContext context,
HttpParams params)
Updates a connection with a layered secure connection.
|
protected final SchemeRegistry schemeRegistry
public DefaultClientConnectionOperator(SchemeRegistry schemes)
schemes
- the scheme registrypublic OperatedClientConnection createConnection()
ClientConnectionOperator
createConnection
in interface ClientConnectionOperator
public void openConnection(OperatedClientConnection conn, HttpHost target, java.net.InetAddress local, HttpContext context, HttpParams params) throws java.io.IOException
ClientConnectionOperator
openConnection
in interface ClientConnectionOperator
conn
- the connection to opentarget
- the target host to connect tolocal
- the local address to route from, or
null
for the defaultcontext
- the context for the connectionparams
- the parameters for the connectionjava.io.IOException
- in case of a problempublic void updateSecureConnection(OperatedClientConnection conn, HttpHost target, HttpContext context, HttpParams params) throws java.io.IOException
ClientConnectionOperator
updateSecureConnection
in interface ClientConnectionOperator
conn
- the open connection to updatetarget
- the target host for the updated connection.
The connection must already be open or tunnelled
to the host and port, but the scheme of the target
will be used to create a layered connection.context
- the context for the connectionparams
- the parameters for the updated connectionjava.io.IOException
- in case of a problemprotected void prepareSocket(java.net.Socket sock, HttpContext context, HttpParams params) throws java.io.IOException
sock
- the socket to preparecontext
- the context for the connectionparams
- the parameters from which to prepare the socketjava.io.IOException
- in case of an IO problem