I want to fetch html page source from URL. Retrofit is doing the job on post Lollipop devices. But on pre-Lollipop devices it gives unsupported protocol error.
Code :
private static final String TAG = "TESTTESTTESTTEST";
private static String url = "https://www.hepsiburada.com/lassa-235-65r17-108h-xl-competush-" +
"l-p-OTLST216410?magaza=LastikArt%C4%B1&utm_source=pc&utm_medium=cimri&utm_campaign" +
"=c&utm_content=c&utm_term=5083&wt_pc=cimri.c.5083.pc/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(ScalarsConverterFactory.create())
.baseUrl("https://www.google.com/")
.build();
IGetHtml iGetHtml = retrofit.create(IGetHtml.class);
Call<String> stringCall = iGetHtml.getHtml(url);
stringCall.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()) {
String responseString = response.body();
Log.e(TAG, "onResponse: " + response.body());
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
Log.e(TAG, "onFailure: " + t);
}
});
}
Error
E/NativeCrypto: Unknown error during handshake 07-09 12:23:57.606
E/TESTTESTTESTTEST:onFailure:javax.net.ssl.SSLHandshakeException:javax.ne.ssl.SSLProtocolException: SSL handshake aborted:ssl=0x7cf6f320: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (external/openssl/ssl/s23_clnt.c:714 0x7a084894:0x00000000)