HTTP/2 with OkHttp

老子叫甜甜 提交于 2019-12-04 09:07:18

ALPN is required for HTTP/2, but it isn’t available in desktop Java until JDK 9. In Java 7 and Java 8 you’ll need a hack called jetty-alpn to enable it.

(For Java 9 there’s ALPN on the platform but only in the upcoming OkHttp 3.3.)

Alternatively, you can use conscrypt with apache, jetty or okhttpclient to get ALPN support in jdk8 itself,

Security.insertProviderAt(Conscrypt.newProvider(), 1);

p.s: use conscrypt-openjdk-uber jar to include all dependencies

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!