I am trying to make an HTTP request to the following domain (http2 enabled) on a device running on Android 7.0.
The code i use is as follows:
Request request = new Request.Builder()
.url("https://http2.akamai.com/")
.build();
response = okHttpClient.newCall(request).execute();
statusCode = response.code();
As I notice in the response object, the protocol used by okHttp is HTTP 1.1
The behavior of the okhttp client is random, at one time I was able to see the protocol as h2
but then repeating the request, it kept selecting HTTP 1.1
I am using okhttp v3.5
What am i possibly missing out here ?
Android has enabled only HTTP/1.1 in its OkHttp.
https://android.googlesource.com/platform/external/okhttp/+/master/android/main/java/com/squareup/okhttp/HttpsHandler.java#75