client can't talk HTTPS to WireMock: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message

huangapple go评论101阅读模式
英文:

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().

huangapple
  • 本文由 发表于 2020年9月3日 05:10:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/63713601.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定