@Override public void onResponse(Call call, Response response) throws IOException { Log.d(logTag, String.valueOf(response.code())); if (response.code() == 404) { throw new IOException(String.format("请求缺少IMEI参数,response code:%s", response.code())); } else if (response.code() == 405) { Message message = new Message(); message.what = 3; handler.sendMessage(message); throw new IOException(String.valueOf(response.code())); } else if (response.body().string() == "IMEIForbidden") { Message message = new Message(); message.what = 4; handler.sendMessage(message); throw new IOException(String.valueOf(response.code())); } else if (!response.isSuccessful()) { throw new IOException(String.format("请求版本时网络异常,response code:%s", response.code())); } LastVersion = response.body().string(); 如上述代码,我想先根据返回的code判断是哪些情况,然后获取body中的String,结果报java.lang.IllegalStateException: closed错误
添加回答
举报
0/150
提交
取消