我有一个 java 编译的包来与网络上的 https 服务器通信。运行编译会出现以下异常:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
我认为这是因为与客户端机器建立的连接不安全。有什么方法可以配置本地机器或端口以连接到远程 https 服务器吗?
I think this is due to the connection established with the client machine is not secure.
这是因为您正在与 HTTP 服务器而非 HTTPS 服务器通信。可能您没有为 HTTPS 使用正确的端口号。
我是一名优秀的程序员,十分优秀!