I am trying to send get request to a server (sending get request for testing, actually I need to send a post request to same server. If get works, post will work)
link to server is https://bits-bosm.org/2017/registrations/signup/
The problem is when I send request using okHttp, I get a failure response saying Handshake failed.
Here is the code I am using to send the request using okHttp (in kotlin)
val request = Request.Builder()
            .url("https://bits-bosm.org/2017/registrations/signup/")
            .build()
    okHttpClient.newCall(request).enqueue(object : Callback {
        override fun onFailure(call: Call?, e: IOException?) {
            val mMessage = e?.message?.toString()
            Log.w("failure Response", mMessage)
        }
        override fun onResponse(call: Call?, response: Response?) {
            val mMessage = response?.body()?.string()
            Log.e("Message", mMessage)
        }
    })
But if I use HttpUrlConnection to send the get request to the same server, I get the response.
Here is the code for the same (java)
private static final String USER_AGENT = "Mozilla/5.0";
private static final String GET_URL = "https://bits-bosm.org/2017/registrations/signup/";
static void sendGET() throws IOException {
    URL obj = new URL(GET_URL);
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("GET");
    con.setRequestProperty("User-Agent", USER_AGENT);
    int responseCode = con.getResponseCode();
    System.out.println("GET Response Code :: " + responseCode);
    if (responseCode == HttpURLConnection.HTTP_OK) { // success
        BufferedReader in = new BufferedReader(new InputStreamReader(
                con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();
        // print result
        Log.e("Result", response.toString());
    } else {
        System.out.println("GET request not worked");
    }
}
From what I have searched the internet and from what I could deduce, the problem is the site is signed using self certificate, and okHttp disallows them. I have even tried using code snippets which I found on Internet which don't check the certificate (Custom SSLSocketFactory) and a few more solutions but none of them worked. Also I don't care about security right now, I just want to get it worked. But I have no access to backend and cannot change/remove ssl security.
What can do to make it work? Is there something which I am missing?
