如何在Android设备上使用http / 2与Okhttp?

我正在testing一个支持HTTP / 2的站点, 像这样 ,我尝试使用okhttp发送请求:

OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.google.it") .build(); okHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Request request, IOException e) { e.printStackTrace(); } @Override public void onResponse(Response response) throws IOException { Log.d("TestHttp", "OkHttp-Selected-Protocol: " + response.header("OkHttp-Selected-Protocol")); Log.d("TestHttp", "Response code is " + response.code()); } }); 

在日志中我有这样的东西:

 OkHttp-Selected-Protocol: http/1.1 

okhttpClientselect使用http / 1.1,我该如何强制它使用HTTP / 2?

Solutions Collecting From Web of "如何在Android设备上使用http / 2与Okhttp?"