英文:
client can't talk HTTPS to WireMock: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
问题
以下是翻译好的部分:
我有以下的模拟配置:
public MockedServer() {
super(new WireMockConfiguration()
.httpsPort(8443)
.keystorePath("identity.jks")
.keystorePassword("password")
);
System.out.println(this.getOptions().httpsSettings());
}
我按照这个教程生成密钥库。
我正在以下方式运行被测试的 JAR:
ProcessBuilder pb = new ProcessBuilder("java","-jar", pathToJar,
"-Djavax.net.ssl.trustStore=" + keystore).start();
问题是客户端抛出了以下异常:
> javax.net.ssl.SSLException: 不支持或无法识别的 SSL 消息
为什么?
还值得一提的是,客户端不应该有 SSL 证书的问题,因为它被(不安全地)配置为信任所有证书。
英文:
I have the following mock configuration:
public MockedServer() {
super(new WireMockConfiguration()
.httpsPort(8443)
.keystorePath("identity.jks")
.keystorePassword("password")
);
System.out.println(this.getOptions().httpsSettings());
}
I followed this tutorial to generate the keystore
And I'm running the tested JAR as follows:
ProcessBuilder pb = new ProcessBuilder("java","-jar", pathToJar,
"--Djavax.net.ssl.trustStore=" + keystore).start();
The problem is that the client throws the following exception:
> javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
Why?
It's also worth mentioning that there shouldn't be an SSL certificate issue from the client as it is (insecurely) configured to trust all certs.
答案1
得分: 0
找到问题了,最终我会留给未来的读者:
在访问端口时,应该使用 httpsPort()
而不是 port()
。
英文:
Found the problem finally. I'll leave it for future readers:
When accessing the port you should use httpsPort()
and not port()
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论