从Java客户端测试Web服务中的javax.net.ssl.SSLHandshakeException

我正在测试用于将数据注册到使用标头的api键的Web服务的Web服务,使用此代码时会出错

请帮助我,所有答案将不胜感激

URL url = new URL("https://xxxxRequest");
            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type","application/json; charset=utf-8 ");
    //some headers and params

            OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream());
            os.write(json.toString());
            os.flush();
            conn.connect();
            recode = conn.getResponseCode();

错误

javax.net.ssl.SSLHandshakeException: Failed to negotiate the use of secure renegotiation
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:306)
    at sun.security.ssl.ClientHandshaker.serverHello(ClientHandshaker.java:513)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:207)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
gh88186024 回答:从Java客户端测试Web服务中的javax.net.ssl.SSLHandshakeException

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2359442.html

大家都在问