private class HttpProxy.CreateTunnelPromise extends java.lang.Object implements Promise<Connection>
Creates a tunnel using HTTP CONNECT.
It is implemented as a promise because it needs to establish the tunnel after the TCP connection is succeeded, and needs to notify the nested promise when the tunnel is established (or failed).
Promise.Adapter<U>, Promise.Completable<S>, Promise.Wrapper<W>| Modifier and Type | Field and Description |
|---|---|
private ClientConnectionFactory |
connectionFactory |
private java.util.Map<java.lang.String,java.lang.Object> |
context |
private EndPoint |
endPoint |
private Promise<Connection> |
promise |
| Modifier | Constructor and Description |
|---|---|
private |
CreateTunnelPromise(ClientConnectionFactory connectionFactory,
EndPoint endPoint,
Promise<Connection> promise,
java.util.Map<java.lang.String,java.lang.Object> context) |
| Modifier and Type | Method and Description |
|---|---|
void |
failed(java.lang.Throwable x)
Callback invoked when the operation fails.
|
void |
succeeded(Connection connection)
Callback invoked when the operation completes.
|
private void |
tunnel(HttpDestination destination,
Connection connection) |
private void |
tunnelFailed(EndPoint endPoint,
java.lang.Throwable failure) |
private void |
tunnelSucceeded(EndPoint endPoint) |
private final ClientConnectionFactory connectionFactory
private final EndPoint endPoint
private final Promise<Connection> promise
private final java.util.Map<java.lang.String,java.lang.Object> context
private CreateTunnelPromise(ClientConnectionFactory connectionFactory, EndPoint endPoint, Promise<Connection> promise, java.util.Map<java.lang.String,java.lang.Object> context)
public void succeeded(Connection connection)
PromiseCallback invoked when the operation completes.
succeeded in interface Promise<Connection>connection - the contextPromise.failed(Throwable)public void failed(java.lang.Throwable x)
PromiseCallback invoked when the operation fails.
failed in interface Promise<Connection>x - the reason for the operation failureprivate void tunnel(HttpDestination destination, Connection connection)
private void tunnelSucceeded(EndPoint endPoint)
private void tunnelFailed(EndPoint endPoint, java.lang.Throwable failure)