七牛 java sdk, fetch接口报错?

Messages:
Found interface com.squareup.okhttp.Connection, but class was expected
File: com/qiniu/http/Client.java
Line number: 39

用的未经修改的fetch接口,执行到Client类39行报错,想问下这个接口有问题吗,默认的用不了吗,一定要改吗,
查到http://segmentfault.com/q/101...抓取资源(fetch)的java示例代码
里面有改过的fetch接口,可以我想改,有些类找不到jar包,无法重新编译,特别是这个CallRet类
public Client() {

    Dispatcher dispatcher = new Dispatcher();
    dispatcher.setMaxRequests(64);
    dispatcher.setMaxRequestsPerHost(16);
    ConnectionPool connectionPool = new ConnectionPool(32, 5 * 60 * 1000);
    httpClient = new OkHttpClient();
    httpClient.setDispatcher(dispatcher);
    httpClient.setConnectionPool(connectionPool);
    httpClient.networkInterceptors().add(new Interceptor() {
        @Override
        public com.squareup.okhttp.Response intercept(Chain chain) throws IOException {
            Request request = chain.request();

            com.squareup.okhttp.Response response = chain.proceed(request);
            IpTag tag = (IpTag) request.tag();
          39行  String ip = chain.connection().getSocket().getRemoteSocketAddress().toString();
            tag.ip = ip;
            return response;
        }
    });
    httpClient.setConnectTimeout(Config.CONNECT_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setReadTimeout(Config.RESPONSE_TIMEOUT, TimeUnit.SECONDS);
}
阅读 3.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏