При выполнении запроса возникает ошибка:
error: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x51859170: Failure in SSL library, usually a protocol error
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x4e9ab898:0x00000000)
Код:
public interface PhotoLink
{
@GET("/photos")
Observable<JsonObject> getPhotoList(@Query("client_id") String client_id);
}
public class ListPhotoPresenter extends MvpBasePresenter<ListPhotoView> implements IListPhotoPresenter
{
private final String URL = "https://api.unsplash.com";
private final String KEY = "5a56756e4fd4b387aa6c1adf99efb0c17bcbbaa2a99ed0b21ba";
Gson gson = new GsonBuilder().create();
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(URL)
.build();
PhotoLink inf = retrofit.create(PhotoLink.class);
@Override
public void init()
{
Map<String, String> map = new HashMap<>();
map.put("client_id", KEY);
Observable<JsonObject> call = inf.getPhotoList(KEY); //здесь возникает ошибка
call
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<JsonObject>()
{
@Override
public void onSubscribe(Disposable d)
{
}
@Override
public void onNext(JsonObject value)
{
String str = value.toString();
PhotoList w = gson.fromJson(str, PhotoList.class);
}
@Override
public void onError(Throwable e)
{
Log.d("myLog","error: " + e.getMessage());
}
@Override
public void onComplete()
{
}
});
}
}