Added missing #disconnectEndpoint method to AsyncConnectExec

This commit is contained in:
Oleg Kalnichevski 2023-11-30 13:21:52 +01:00
parent 8a2b0f584a
commit a46c9e5656
3 changed files with 21 additions and 0 deletions

View File

@ -106,6 +106,11 @@ public interface AsyncExecRuntime {
HttpClientContext context,
FutureCallback<AsyncExecRuntime> callback);
/**
* Disconnects the local endpoint from the initial hop in the connection route.
*/
void disconnectEndpoint();
/**
* Upgrades transport security of the active connection by using the TLS security protocol.
*

View File

@ -215,6 +215,14 @@ class InternalH2AsyncExecRuntime implements AsyncExecRuntime {
}
@Override
public void disconnectEndpoint() {
final Endpoint endpoint = sessionRef.get();
if (endpoint != null) {
endpoint.session.close(CloseMode.GRACEFUL);
}
}
@Override
public void upgradeTls(final HttpClientContext context) {
throw new UnsupportedOperationException();

View File

@ -235,6 +235,14 @@ class InternalHttpAsyncExecRuntime implements AsyncExecRuntime {
}
@Override
public void disconnectEndpoint() {
final AsyncConnectionEndpoint endpoint = endpointRef.get();
if (endpoint != null) {
endpoint.close(CloseMode.GRACEFUL);
}
}
@Override
public void upgradeTls(final HttpClientContext context) {
upgradeTls(context, null);