Ask questionsOkHttp 3.x fails with OpenJDK Zulu 8.0.252

Hi folks,

We found that this particular piece of code in okhttp 3.x: breaks.

This checks for setApplicationProtocols and getApplicationProtocol which are JDK 9. however, these ones got backported to Zulu 8.0.252 causing OkHttp believing that is running on jdk9 and initializing a Jdk9Platform which breaks projects

Wondering if a patch could be released for 3.x since there are several libraries and projects out there that haven't migrated to 4.x



Answer questions DanielThomas

Ah! It's the combination of the JDK 9 platform activation our internal mTLS wrapper that delegates to the underlying impl that's breaking this on our end - it doesn't implement those methods causing those calls to fall through to SslSocket and hit the UnsupportedOperationException. Guess we'll have to conditionally drop in the right wrapper depending on the method availability.

Guess u252 and upwards still needs a leg up on OkHttp 3 and 4 so the built-in ALPN support does activate there. Seems like OkHttp 3 will work by default, OkHttp 4 will not activate built-in ALPN support in this release.


Related questions

OkHttp3 - IOException: unexpected end of stream on okhttp3.Address@9d7c59b5 hot 3
4.0.0-alpha02 ProGuard issues hot 2
new OkhttpClient() crash on android 4.4 hot 2 Chain validation failed hot 2
okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR/ CANCEL hot 1 \n not found: limit=0 content=… hot 1
Tomcat is not able to stop because of "OkHttp ConnectionPool" and "Okio Watchdog" threads hot 1
okhttp fails with IOException: gzip finished without exhausting source but GZIPInputStream works hot 1
R8 NullPointerException with OkHttp 3.13.1 hot 1
Android cleaning fails with custom trust manager and logging hot 1
okhttp 4.3.0 crash with custom X509TrustManager hot 1
ExceptionInitializerError with new Android 11 version (DP1) - okhttp hot 1
Version 3.10.0 error using Proguard on Android Studio hot 1
Docs should explain benefits of pinning both CA and host certificates hot 1
java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found hot 1
Github User Rank List