Make HttpComponentsAsyncClientHttpRequest abortable
This commit aborts the HttpComponentsAsyncClientHttpRequest whenever the
returned Future is canceled.
Issue: SPR-14845
(cherry picked from commit 8f84446)
This commit is contained in:
committed by
Juergen Hoeller
parent
edf1df33cc
commit
b6b536682e
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -222,4 +222,14 @@ public abstract class AbstractAsyncHttpRequestFactoryTestCase extends AbstractJe
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cancel() throws Exception {
|
||||
URI uri = new URI(baseUrl + "/status/notfound");
|
||||
AsyncClientHttpRequest request = this.factory.createAsyncRequest(uri, HttpMethod.GET);
|
||||
Future<ClientHttpResponse> futureResponse = request.executeAsync();
|
||||
futureResponse.cancel(true);
|
||||
assertTrue(futureResponse.isCancelled());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user