Mis*_*r.E 5 vpn retrofit2 okhttp3
我一直在公司网络上使用我的代码,它确实可以正常工作,但是当我想在家中使用它(使用vpn连接到公司网络)时,它无法显示:无法解析主机X:否与主机名关联的地址。
奇怪的是,我实际上可以在浏览器中使用链接(工作正常)。我需要添加任何配置吗?
OkHttpClient defaultHttpClient = new OkHttpClient.Builder()
.addInterceptor(new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
Request authorisedRequest = chain.request().newBuilder()
.addHeader("Authorization", TNConstants.BASIC +
Base64.encodeToString((username+ ":" + password).getBytes(), Base64.NO_WRAP)).build();
return chain.proceed(authorisedRequest);
}}).build();
Run Code Online (Sandbox Code Playgroud)
它实际上在chain.proceed(authorisedRequest)函数中失败。请帮我。谢谢!
| 归档时间: |
|
| 查看次数: |
193 次 |
| 最近记录: |