改装电话:

 RestAdapter restAdapter = new RestAdapter.Builder()
        .setEndpoint("BASE URL")
        .setLogLevel(RestAdapter.LogLevel.FULL)
        .setClient(new OkClient(getOkHttpClient()))
        .build();

依赖项:
compile 'com.squareup.okhttp:okhttp:2.7.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'

错误:
用户ID=x xxx,项目ID=x,项目数量=1,项目成本=xxxx,付款ID=stripe,流程费=xxx,总成本=xxx,谈判ID=0,提示=xxx,卡ID=xxxx
09-07 11:45:08.628 23473-24373/com.bridgellc.bridge d/改造:--->
结束http(177字节正文)09-07 11:45:18.635
23473-24373/com.bridgellc.bridge d/reformation:----错误http:xxxxxx
09-07 11:45:18.650 23473-24373/com.bridgellc.bridge d/改装:
java.net.socketTimeoutException

最佳答案

尝试为okhttp2客户端设置超时。首先创建一个okhttp2客户机,

OkHttpClient client = new OkHttpClient.Builder()
client.setConnectTimeout(5, TimeUnit.MINUTES);
client.setReadTimeout(5, TimeUnit.MINUTES);
.build();

然后将其添加为改造的默认客户机
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("BASE_URL")
.setLogLevel(RestAdapter.LogLevel.FULL)
.setClient(client).build();

关于android - 改造java.net.SocketTimeoutException,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39362943/

10-09 16:00