Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
5.1
-
None
Description
CloseableHttpAsyncClient with HttpVersionPolicy.NEGOTIATE is NOT working with Open JDK greater or equals 16. When we force HttpVersionPolicy to HTTP_1 or HTTP_2, we do not face any issue. The issue happens only with HttpVersionPolicy.NEGOTIATE.
We have the Following exception :
Executing request GET https://nghttp2.org/httpbin/ GET https://nghttp2.org/httpbin/->org.apache.hc.core5.http.ConnectionClosedException: Connection closed by peer Exception in thread "main" java.util.concurrent.ExecutionException: org.apache.hc.core5.http.ConnectionClosedException: Connection closed by peer at org.apache.hc.core5.concurrent.BasicFuture.getResult(BasicFuture.java:72) at org.apache.hc.core5.concurrent.BasicFuture.get(BasicFuture.java:85) at org.apache.hc.client5.http.examples.main(AsyncClientTlsAlpn.java:85) Caused by: org.apache.hc.core5.http.ConnectionClosedException: Connection closed by peer at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onInput(AbstractHttp1StreamDuplexer.java:341) at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.inputReady(AbstractHttp1IOEventHandler.java:64) at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.inputReady(ClientHttp1IOEventHandler.java:39) at org.apache.hc.core5.reactor.ssl.SSLIOSession.decryptData(SSLIOSession.java:549) at org.apache.hc.core5.reactor.ssl.SSLIOSession.access$400(SSLIOSession.java:72) at org.apache.hc.core5.reactor.ssl.SSLIOSession$1.inputReady(SSLIOSession.java:172) at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:131) at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51) at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178) at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127) at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85) at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44) at java.base/java.lang.Thread.run(Thread.java:833)
In order to reproduce :
Execute the following java class ( https://raw.githubusercontent.com/apache/httpcomponents-client/5.1.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java ) with a version of OpenJDK <= 15 then you will succesfully get the result. After, execute the same class with OpenJDK 17, then you you will face the issue.