杏彩体育 v1.0.1版本的 MD5 值为:f363e7619122f7bd90c8b2a2d9a7cb53
以下内容为反编译后的 Client.java 源代码,内容仅作参考
package com.xtree.base.net;
import com.xtree.base.utils.CfLog;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class Client {
public static final int DEFAULT_READ_TIMEOUT_SECONDS = 60;
public static final int DEFAULT_TIMEOUT_SECONDS = 6;
public static final int DEFAULT_WRITE_TIMEOUT_SECONDS = 30;
private static String DOMAIN_URL_DEF = "https://www.weres.bar";
private static OkHttpClient client;
private static String domainUrl;
private static Retrofit mRetrofit;
public static String baseUrl() {
domainUrl = DOMAIN_URL_DEF;
CfLog.i("get domainUrl: " + domainUrl);
return domainUrl;
}
public static OkHttpClient getClient() {
if (client == null) {
client = new OkHttpClient.Builder().connectTimeout(6L, TimeUnit.SECONDS).readTimeout(60L, TimeUnit.SECONDS).writeTimeout(30L, TimeUnit.SECONDS).addInterceptor(AccessTokenInterceptor.newInstance()).addInterceptor(new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public final void log(String str) {
CfLog.d(str);
}
}).setLevel(HttpLoggingInterceptor.Level.BODY)).sslSocketFactory(new SSLSocketFactoryCompat(SSLSocketFactoryCompat.trustAllCert), SSLSocketFactoryCompat.trustAllCert).build();
}
return client;
}
public static Retrofit getRetrofit() {
if (mRetrofit == null) {
mRetrofit = new Retrofit.Builder().baseUrl(baseUrl()).client(getClient()).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build();
}
return mRetrofit;
}
public static <T> T getService(Class<T> cls) {
return (T) getRetrofit().create(cls);
}
}