square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
43.11k stars 7.3k forks source link

OkHttp 3.x fails with Java 8u252 #3370

Closed shabtaisharon closed 4 years ago

shabtaisharon commented 4 years ago

Updating from Amazon Corretto 8u242 to 8u252 I'm getting this error:

java.lang.UnsupportedOperationException: clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+
    at okhttp3.internal.platform.Jdk9Platform.trustManager(Jdk9Platform.java:77)
    at okhttp3.internal.platform.Platform.buildCertificateChainCleaner(Platform.java:177)
    at okhttp3.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.java:743)
    at com.spectralogic.blackpearl.management.network.RetroFitBuilder.build(RetroFitBuilder.java:71)

I'm using the lastest retrofit version 2.8.1.

Reading online this seems to be a known issue with OkHttp and it looks like the issue is fixed with OkHttps >4.3.0

Please let me know if more info is needed.

JakeWharton commented 4 years ago

This is tracked at https://github.com/square/okhttp/issues/5970. No action on our side until there's an OkHttp 3.14 release to fix it.

If you can use OkHttp 4, please do!

yschimke commented 4 years ago

@shabtaisharon Also worth calling out that it needs a fix in Coretto also. This UnsupportedOperationException is basically saying that they no longer support ALPN therefore HTTP/2.

alpn-boot is explicitly not supported from 252 onwards.

So with the "fix" in 3.14.x is that you'll get plain old HTTP/1.1.

shabtaisharon commented 4 years ago

I've updated my OkHttp to 4.5.0 and everything seems to work, thanks!

JakeWharton commented 4 years ago

This shipped in Retrofit 2.8.2.