|
|
@ -7,6 +7,7 @@ import okhttp3.ConnectionSpec |
|
|
|
import okhttp3.Credentials |
|
|
|
import okhttp3.Credentials |
|
|
|
import okhttp3.Interceptor |
|
|
|
import okhttp3.Interceptor |
|
|
|
import okhttp3.OkHttpClient |
|
|
|
import okhttp3.OkHttpClient |
|
|
|
|
|
|
|
import timber.log.Timber |
|
|
|
import java.net.InetSocketAddress |
|
|
|
import java.net.InetSocketAddress |
|
|
|
import java.net.Proxy |
|
|
|
import java.net.Proxy |
|
|
|
import java.util.concurrent.ConcurrentHashMap |
|
|
|
import java.util.concurrent.ConcurrentHashMap |
|
|
@ -44,8 +45,12 @@ val okHttpClient: OkHttpClient by lazy { |
|
|
|
chain.proceed(request) |
|
|
|
chain.proceed(request) |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (AppConfig.isCronet && CronetLoader.install()) { |
|
|
|
if (AppConfig.isCronet && CronetLoader.install()) { |
|
|
|
//提供CookieJar 用于同步Cookie |
|
|
|
try { |
|
|
|
builder.addInterceptor(CronetInterceptor(null)) |
|
|
|
//提供CookieJar 用于同步Cookie |
|
|
|
|
|
|
|
builder.addInterceptor(CronetInterceptor(null)) |
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
|
|
|
Timber.e(e, "初始化Cronet失败") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
builder.build() |
|
|
|
builder.build() |
|
|
|
} |
|
|
|
} |
|
|
|