0

When I call a https url in java, am getting this error

java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake

The url is hosted on internet, and its public, can anyone suggest me what could be the issue?

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
        StringBuilder builder = new StringBuilder();
        builder.append("grant_type=").append("grant_type").
                append("&client_id=").append("client_id").
                append("&client_secret=").append("my_secret").
                append("&scope=").append("my_Scope");
        RequestBody body = RequestBody.create(builder.toString(), mediaType);
        Request request = new Request.Builder()
                .url("https_url")
                .method("POST", body)
                .addHeader("Content-Type", "application/x-www-form-urlencoded")
                .build();
        Response response = null;
      
            response = getClient().newCall(request).execute();
Hari M
  • 19
  • 1
  • 9

0 Answers0