SSLException:写入错误:ssl = 0x7f8170c780:系统调用期间的I / O错误,连接超时

时间:2017-04-19 03:17:27

标签: okhttp3

我使用okhttp和retrofit2发布音频文件,但有时文件损坏(服务器端),是什么原因?

File file = new File(path);
RequestBody requestFile = RequestBody.create(MediaType.parse("audio/*"), file);
body = MultipartBody.Part.createFormData("audio_file", file.getName(), requestFile);

HashMap<String,RequestBody> params = new HashMap<>();
params.put("lecture_id",RequestBody.create(MediaType.parse("multipart/form-data"), mId + ""));
params.put("duration",RequestBody.create(MediaType.parse("multipart/form-data"),attachment.getDuration() + ""));
params.put("reply_message_id",RequestBody.create(MediaType.parse("multipart/form-data"),msg.getReplyMsgId() + ""));

Subscription subscription = ApiService.getInstance().sendAudioMessage(body,params).subscribe(new HttpObserver<IMMessage>() {
    @Override
    protected void onError(ApiException ex) {
        CrashReport.postCatchedException(ex);
        ToastUtil.showToast(getActivity(),ex.getMsg());
        onSendMessageFail(msg);
    }

    @Override
    public void onNext(IMMessage imMessage) {
        onSendMessageSuccess(msg);
    }
});
mCompositeSubscription.add(subscription);

0 个答案:

没有答案