首页 > 七牛 java sdk, fetch接口报错

七牛 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://.com/q/1010000000455177抓取资源(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);
}
【热门文章】
【热门文章】