1 package com.foxinmy.weixin4j.http.support.okhttp;
2
3 import com.foxinmy.weixin4j.http.HttpClient;
4 import com.foxinmy.weixin4j.http.HttpParams;
5 import com.foxinmy.weixin4j.http.factory.HttpClientFactory;
6
7
8
9
10
11
12
13
14
15 public class OkHttpClientFactory extends HttpClientFactory {
16 private static HttpClientFactory okHttpClientFactory;
17 static {
18 try {
19 okHttpClientFactory = new OkHttpClient3Factory();
20 } catch (Throwable e1) {
21 try {
22 okHttpClientFactory = new OkHttpClient2Factory();
23 } catch (Throwable e2) {
24 throw new RuntimeException(e2);
25 }
26 }
27 }
28
29 @Override
30 public HttpClient newInstance(HttpParams params) {
31 return okHttpClientFactory.newInstance(params);
32 }
33 }