use of io.vertx.core.http.HttpTestBase.DEFAULT_HTTPS_PORT in project vert.x by eclipse.
the class WebSocketTest method testWebSocketAbs.
@Test
public void testWebSocketAbs() {
HttpServerOptions serverOptions = new HttpServerOptions().setPort(DEFAULT_HTTPS_PORT).setSsl(true).setKeyCertOptions(Cert.SERVER_JKS.get());
HttpClientOptions clientOptions = new HttpClientOptions().setTrustAll(true).setVerifyHost(false);
client = vertx.createHttpClient(clientOptions);
server = vertx.createHttpServer(serverOptions).requestHandler(request -> {
if ("/test".equals(request.path())) {
request.toWebSocket().onComplete(onSuccess(ServerWebSocket::close));
} else {
request.response().end();
}
}).listen(onSuccess(server -> {
String url = "wss://" + clientOptions.getDefaultHost() + ":" + DEFAULT_HTTPS_PORT + "/test";
client.webSocketAbs(url, null, null, null, onSuccess(ws -> {
ws.closeHandler(v -> {
testComplete();
});
}));
}));
await();
}
Aggregations