How can I verify that okhttp negotiated http/2 successfully and did not use https/1.1 instead? Is there some info in the response I can check?
Thanks, -Tony
OkHttp (https://square.github.io/okhttp/) is an efficient HTTP & HTTP/2 client for Android and Java applications. It's been widely used in Android and has good documentation also.
OkHttp Overview At a high level, the client is designed for both blocking synchronous calls and nonblocking asynchronous calls. OkHttp supports Android 2.3 and above.
Beginning with Mobile SDK 4.2, the Android REST request system uses OkHttp (v3. 2.0), an open-source external library from Square Open Source, as its underlying architecture. This library replaces the Google Volley library from past releases.
OkHttp android provides an implementation of HttpURLConnection and Apache Client interfaces by working directly on a top of java Socket without using any extra dependencies.
FYI since okhttp 3.0 or so OkHttp-Selected-Protocol
is not printed.
The protocol can be easily seen in the response object though.
Ok I think I got the answer. If I print out the response headers I got this: OkHttp-Selected-Protocol: h2
Am I to assume it negotiated successfully the response for http/2?
Thanks! -tony
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With