java.lang.Object | |
↳ | org.apache.http.impl.conn.DefaultClientConnectionOperator |
Default implementation of a ClientConnectionOperator
. It uses a SchemeRegistry
to look up SchemeSocketFactory
objects.
This connection operator is multihome network aware and will attempt to retry failed connects
against all known IP addresses sequentially until the connect is successful or all known
addresses fail to respond. Please note the same
CONNECTION_TIMEOUT
value will be used
for each connection attempt, so in the worst case the total elapsed time before timeout
can be CONNECTION_TIMEOUT * n
where n
is the number of IP addresses
of the given host. One can disable multihome support by overriding
the resolveHostname(String)
method and returning only one IP address for the given
host name.
The following parameters can be used to customize the behavior of this class:
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
schemeRegistry | The scheme registry for looking up socket factories. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new client connection operator for the given scheme registry.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new connection that can be operated.
| |||||||||||
Opens a connection to the given target host.
| |||||||||||
Updates a connection with a layered secure connection.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Performs standard initializations on a newly created socket.
| |||||||||||
Resolves the given host name to an array of corresponding IP addresses, based on the
configured name service on the system.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
The scheme registry for looking up socket factories.
Creates a new client connection operator for the given scheme registry.
schemes | the scheme registry |
---|
Creates a new connection that can be operated.
Opens a connection to the given target host.
conn | the connection to open |
---|---|
target | the target host to connect to |
local | the local address to route from, or
null for the default |
context | the context for the connection |
params | the parameters for the connection |
IOException |
---|
Updates 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).
conn | the open connection to update |
---|---|
target | 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 connection |
params | the parameters for the updated connection |
IOException |
---|
Performs standard initializations on a newly created socket.
sock | the socket to prepare |
---|---|
context | the context for the connection |
params | the parameters from which to prepare the socket |
IOException | in case of an IO problem |
---|
Resolves the given host name to an array of corresponding IP addresses, based on the configured name service on the system.
host | host name to resolve |
---|
UnknownHostException | if no IP address for the host could be determined. |
---|