java8早期版本是不支持http2,需要借助Jetty ALPAN Agent
否则会报错,例如使用okhttp发送请求的时候:
c
Suppressed: java.io.IOException: unexpected end of stream on https://xxxxxx./...
... 17 common frames omitted
Caused by: java.io.EOFException: \n not found: limit=99 content=000018040000000000000100001000000300000001000500004000000600001f…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:335)
at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
....
Suppressed: java.io.IOException: unexpected end of stream on https://xxxxxx./...
... 17 common frames omitted
Caused by: java.io.EOFException: \n not found: limit=99 content=000018040000000000000100001000000300000001000500004000000600001f…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:335)
at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
....
但是从 OpenJDK 1.8.0_252 开始,不再严格要求使用 jetty-alpn-agent ,因为标准 ALPN API 已从 Java 9 移植到 OpenJDK 1.8.0_252。 也就是只需要保证jdk版本不小于1.8.0_252就ok了。