OkHttpClient java.security.InvalidAlgorithmParameterException

时间:2018-08-01 07:06:06

标签: java okhttp

当前,我正在尝试使用OkHttpClient发送请求,以下是我的代码。

public void mattermostresponse(String massage) {
    OkHttpClient client = new OkHttpClient();


    MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
    RequestBody body = RequestBody.create(mediaType, "payload={"Some parameters");
    Request request = new Request.Builder()
            .url("https://test.com")
            .post(body)
            .addHeader("Content-Type", "application/x-www-form-urlencoded")
            .addHeader("Cache-Control", "no-cache")

            .build();


        try {
            Response response = client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

运行此代码时,显示

  

原因:java.lang.RuntimeException:意外错误:   java.security.InvalidAlgorithmParameterException:trustAnchors   参数必须为非空

**如何关闭ssl验证? **任何帮助或建议将不胜感激

0 个答案:

没有答案