[
https://issues.apache.org/jira/browse/HTTPCLIENT-2182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17428119#comment-17428119
]
Oleg Kalnichevski commented on HTTPCLIENT-2182:
-----------------------------------------------
[~ymaiga] The problem is quite simple and is not really a bug in HttpClient. As
of Java 16 access to internal classes such as SSLSession via reflection is
disallowed. HttpClient 5.2 now can use new Java 1.8 APIs introduced by 8u251
update. HttpClient 5.1 cannot do that as it is still bound to Java 1.7
compatibility.
Uncomment this block of code in the AsyncClientTlsAlpn and it will work with
Java 16 and 17.
{code:java}
/*
.setTlsDetailsFactory(new Factory<SSLEngine, TlsDetails>() {
@Override
public TlsDetails create(final SSLEngine sslEngine) {
return new TlsDetails(sslEngine.getSession(),
sslEngine.getApplicationProtocol());
}
})
*/
{code}
Oleg
> [CloseableHttpAsyncClient] HttpVersionPolicy.NEGOTIATE Not working with Open
> JDK >= 16
> --------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2182
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2182
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (async)
> Affects Versions: 5.1
> Reporter: Youssouf Maiga
> Priority: Major
> Fix For: 5.2-alpha1
>
>
> 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 :
> {code:java}
> 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)
> {code}
> 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|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.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]