尝试在JVM 1.8.0_152上使用vert.x 3.7.1连接到使用LetsEncrypt证书的https服务器。虽然有效,例如使用www.google.com
时,我得到javax.net.ssl.SSLException
:收到致命警报:handshake_failure
我的代码:
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.client.WebClientOptions;
public class ClientTest extends AbstractVerticle {
private WebClient webClient;
public static void main(String[] args) {
//Runner.runVerticle(ClientTest.class.getName(), true);
Vertx vertx = Vertx.vertx();
ClientTest clientTest = new ClientTest();
vertx.deployVerticle(clientTest);
}
@Override
public void start() {
WebClientOptions clientOptions = new WebClientOptions()
.setMaxInitialLineLength(10000).setLogActivity(true)
.setTryUseCompression(true).setSsl(true).setTrustAll(true)
.setVerifyHost(false);
webClient = WebClient.create(vertx, clientOptions);
Set<String> hostList = new HashSet<>(Arrays.asList("www.wissel.net","www.google.com"));
hostList.forEach(host -> {
System.out.println("Connecting to "+host);
webClient.get(443, host, "/")
.send(ar -> {
if (ar.failed()) {
ar.cause().printStackTrace();
} else {
System.out.println(host+" returnCode:"+ ar.result().statusCode());
}
});
});
}
}
我正在尝试在Mac上运行它。 我想念什么?