Package org.apache.http.impl.conn
Class DefaultClientConnectionOperator
java.lang.Object
org.apache.http.impl.conn.DefaultClientConnectionOperator
- All Implemented Interfaces:
ClientConnectionOperator
public class DefaultClientConnectionOperator extends Object implements ClientConnectionOperator
Default implementation of a
ClientConnectionOperator.
It uses a SchemeRegistry to look up
SocketFactory objects.- Since:
- 4.0
- Version:
- $Revision: 652193 $ $Date: 2008-04-29 17:10:36 -0700 (Tue, 29 Apr 2008) $
- Author:
- Roland Weber
-
Field Summary
Fields Modifier and Type Field Description protected SchemeRegistryschemeRegistryThe scheme registry for looking up socket factories. -
Constructor Summary
Constructors Constructor Description DefaultClientConnectionOperator(SchemeRegistry schemes)Creates a new client connection operator for the given scheme registry. -
Method Summary
Modifier and Type Method Description OperatedClientConnectioncreateConnection()Creates a new connection that can be operated.voidopenConnection(OperatedClientConnection conn, HttpHost target, InetAddress local, HttpContext context, HttpParams params)Opens a connection to the given target host.protected voidprepareSocket(Socket sock, HttpContext context, HttpParams params)Performs standard initializations on a newly created socket.voidupdateSecureConnection(OperatedClientConnection conn, HttpHost target, HttpContext context, HttpParams params)Updates a connection with a layered secure connection.
-
Field Details
-
schemeRegistry
The scheme registry for looking up socket factories.
-
-
Constructor Details
-
DefaultClientConnectionOperator
Creates a new client connection operator for the given scheme registry.- Parameters:
schemes- the scheme registry
-
-
Method Details
-
createConnection
Description copied from interface:ClientConnectionOperatorCreates a new connection that can be operated.- Specified by:
createConnectionin interfaceClientConnectionOperator- Returns:
- a new, unopened connection for use with this operator
-
openConnection
public void openConnection(OperatedClientConnection conn, HttpHost target, InetAddress local, HttpContext context, HttpParams params) throws IOExceptionDescription copied from interface:ClientConnectionOperatorOpens a connection to the given target host.- Specified by:
openConnectionin interfaceClientConnectionOperator- Parameters:
conn- the connection to opentarget- the target host to connect tolocal- the local address to route from, ornullfor the defaultcontext- the context for the connectionparams- the parameters for the connection- Throws:
IOException- in case of a problem
-
updateSecureConnection
public void updateSecureConnection(OperatedClientConnection conn, HttpHost target, HttpContext context, HttpParams params) throws IOExceptionDescription copied from interface:ClientConnectionOperatorUpdates a connection with a layered secure connection. The typical use of this method is to update a tunnelled plain connection (HTTP) to a secure TLS/SSL connection (HTTPS).- Specified by:
updateSecureConnectionin interfaceClientConnectionOperator- Parameters:
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 connection- Throws:
IOException- in case of a problem
-
prepareSocket
protected void prepareSocket(Socket sock, HttpContext context, HttpParams params) throws IOExceptionPerforms standard initializations on a newly created socket.- Parameters:
sock- the socket to preparecontext- the context for the connectionparams- the parameters from which to prepare the socket- Throws:
IOException- in case of an IO problem
-