如何使用OkHttp Library为Android客户端提供spdy支持?

时间:2014-06-27 15:55:08

标签: android client-side spdy okhttp

我想制作一个支持Speedy(SPDY)的Android客户端的简单应用程序,但我真的被卡住了。

我正在使用我正在制作的应用程序中的OkHttp的v2.0.0 JAR。我使用了以下代码(取自here):

package com.squareup.okhttp.guide;

import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;

public class GetExample {
  OkHttpClient client = new OkHttpClient();

  String run(String url) throws IOException {
    Request request = new Request.Builder()
        .url(url)
        .build();

    Response response = client.newCall(request).execute();
    return response.body().string();
  }

  public static void main(String[] args) throws IOException {
    GetExample example = new GetExample();
    String response = example.run("https://raw.github.com/square/okhttp/master/README.md");
    System.out.println(response);
  }
}

此处的nextCall()方法无法执行。它反复说明nextCall()类中不存在OkHttpClient方法。

0 个答案:

没有答案