Skip to content

Commit a46c9e5

Browse files
committed
Added missing #disconnectEndpoint method to AsyncConnectExec
1 parent 8a2b0f5 commit a46c9e5

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecRuntime.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ Cancellable connectEndpoint(
106106
HttpClientContext context,
107107
FutureCallback<AsyncExecRuntime> callback);
108108

109+
/**
110+
* Disconnects the local endpoint from the initial hop in the connection route.
111+
*/
112+
void disconnectEndpoint();
113+
109114
/**
110115
* Upgrades transport security of the active connection by using the TLS security protocol.
111116
*

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ public void cancelled() {
215215

216216
}
217217

218+
@Override
219+
public void disconnectEndpoint() {
220+
final Endpoint endpoint = sessionRef.get();
221+
if (endpoint != null) {
222+
endpoint.session.close(CloseMode.GRACEFUL);
223+
}
224+
}
225+
218226
@Override
219227
public void upgradeTls(final HttpClientContext context) {
220228
throw new UnsupportedOperationException();

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ public void completed(final AsyncConnectionEndpoint endpoint) {
235235

236236
}
237237

238+
@Override
239+
public void disconnectEndpoint() {
240+
final AsyncConnectionEndpoint endpoint = endpointRef.get();
241+
if (endpoint != null) {
242+
endpoint.close(CloseMode.GRACEFUL);
243+
}
244+
}
245+
238246
@Override
239247
public void upgradeTls(final HttpClientContext context) {
240248
upgradeTls(context, null);

0 commit comments

Comments
 (0)