Vimeo SSL Error Using Retrofit on Android

I have a problem Vimeo APIwith using Retrofit. I want to upload MultipartTypedOutputto Vimeo using Retrofit. Here is the code:

public interface VimeoUploadApi {
    @PUT("/upload")
    void uploadVideo(@Header("Authorization") String header,
                     @Body MultipartTypedOutput body,
                     @Query("ticket_id") String ticket_id,
                     BaseCallback<VideoUploadedEvent> callback);
}
public VimeoUploadApi provideVimeoUploadApi(String url) {
    RestAdapter restAdapter = new RestAdapter.Builder()
                .setEndpoint(url)
                .setLogLevel(BuildConfig.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE)
                .build();

    return restAdapter.create(VimeoUploadApi.class);
}

private MultipartTypedOutput generateMultipartObject() {
    MultipartTypedOutput multipartTypedOutput = new MultipartTypedOutput();
    File file = new File(videoPath);
    long totalSize = file.length();
    FileProgressListener listener = new FileProgressListener(totalSize);
    listener.setPath(videoPath);
    multipartTypedOutput.addPart("video", new CountingTypedFile("video/mp4", file, listener));
    return multipartTypedOutput;
}

And the call:

provideVimeoUploadApi(getUploadUrl(secure_link)).uploadVideo(
    "Authorization: Bearer " + Environment.VIMEO_TOKEN,
    generateMultipartObject(),
    event.getTicket_id(),
    new BaseCallback<VideoUploadedEvent>()
);

And when I upload my video, I get this error:

Write error: ssl = 0x98cc2800: I / O error during a system call, connection reset by peer retrofit.RetrofitError: Write error: ssl = 0x98cc2800: I / O error during a system call, connection reset by peer

Called: javax.net.ssl.SSLException: Write error: ssl = 0x98cc2800: I / O error during a system call, connection reset by peer

Anyway, to fix it?

+4
source share
1 answer

, - , Vimeo Retrofit, , old-good HttpUrlConnection . - - , .

0

Source: https://habr.com/ru/post/1598410/


All Articles