How does okhttp3 send http2 requests?

question background:
recently I want to use springboot2.0 to build a server that supports http2.0. After setting up, through Chrome access, it shows that the version of http protocol is H2 (the server has been upgraded successfully and the certificate has been configured successfully).
clipboard.png

okhttp3http2.0responseprotocolhttp1.1

:
1.springboot:
clipboard.png

2.EchoController:ECHO
clipboard.png

3.:


:
clipboard.png
response:
Response{protocol=http/1.1, code=200, message=OK, url=https://localhost:8080/echo}

clipboard.png

build request:
ConnectionUpgrade HTTP/1.1 . HTTP/2 h2c, HTTP/2 ClearText.


:
ECHO!!
HTTP_1_1


@Feng_YuStackOverflowbuild okHttpClienth2


http1.1debugclientbuildh2
clipboard.png

I can"t handle it. I"ll give you some advice on how to make it. Let him fall in the ice. No, no, no.
you can also give some advice from all kinds of gods!


https://stackoverflow.com/que.


jdk1.7,1.8 natively does not support the request that http2.0,okhttp can send 2.0 requests. Your code will be fine after modification, but you need to introduce alpn-boot jar package cooperation to simulate http2.0

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38841-2c112.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38841-2c112.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?