use of io.vertx.core.http.RequestOptions in project vert.x by eclipse.
the class Http1xTLSTest method testRedirectFromSSL.
@Test
public void testRedirectFromSSL() throws Exception {
HttpServer redirectServer = vertx.createHttpServer(new HttpServerOptions().setSsl(true).setKeyStoreOptions(Cert.SERVER_JKS.get()).setHost(DEFAULT_HTTP_HOST).setPort(DEFAULT_HTTP_PORT)).requestHandler(req -> {
req.response().setStatusCode(307).putHeader("location", "http://" + DEFAULT_HTTP_HOST + ":4043/" + DEFAULT_TEST_URI).end();
});
startServer(redirectServer);
RequestOptions options = new RequestOptions().setHost(DEFAULT_HTTP_HOST).setURI(DEFAULT_TEST_URI).setPort(4043);
testTLS(Cert.NONE, Trust.SERVER_JKS, Cert.NONE, Trust.NONE).clientSSL(true).serverSSL(false).requestOptions(options).followRedirects(true).pass();
}
use of io.vertx.core.http.RequestOptions in project vert.x by eclipse.
the class Http1xTLSTest method testRedirectToSSL.
// Redirect tests
@Test
public void testRedirectToSSL() throws Exception {
HttpServer redirectServer = vertx.createHttpServer(new HttpServerOptions().setHost(DEFAULT_HTTP_HOST).setPort(DEFAULT_HTTP_PORT)).requestHandler(req -> {
req.response().setStatusCode(307).putHeader("location", "https://" + DEFAULT_HTTP_HOST + ":4043/" + DEFAULT_TEST_URI).end();
});
startServer(redirectServer);
RequestOptions options = new RequestOptions().setHost(DEFAULT_HTTP_HOST).setURI(DEFAULT_TEST_URI).setPort(DEFAULT_HTTP_PORT);
testTLS(Cert.NONE, Trust.SERVER_JKS, Cert.SERVER_JKS, Trust.NONE).clientSSL(false).serverSSL(true).requestOptions(options).followRedirects(true).pass();
}
use of io.vertx.core.http.RequestOptions in project vert.x by eclipse.
the class Http1xTLSTest method testSSLClientRequestOptionsSetSSL.
@Test
public // Client trusts all server certs
void testSSLClientRequestOptionsSetSSL() throws Exception {
RequestOptions options = new RequestOptions().setHost(DEFAULT_HTTP_HOST).setPort(4043).setURI(DEFAULT_TEST_URI).setSsl(true);
testTLS(Cert.NONE, Trust.SERVER_JKS, Cert.SERVER_JKS, Trust.NONE).clientSSL(true).requestOptions(options).pass();
}
use of io.vertx.core.http.RequestOptions in project vert.x by eclipse.
the class Http1xTLSTest method testClearClientRequestOptionsSetSSL.
// RequestOptions tests
@Test
public // Client trusts all server certs
void testClearClientRequestOptionsSetSSL() throws Exception {
RequestOptions options = new RequestOptions().setHost(DEFAULT_HTTP_HOST).setPort(4043).setURI(DEFAULT_TEST_URI).setSsl(true);
testTLS(Cert.NONE, Trust.SERVER_JKS, Cert.SERVER_JKS, Trust.NONE).clientSSL(false).requestOptions(options).pass();
}
use of io.vertx.core.http.RequestOptions in project vert.x by eclipse.
the class Http1xTLSTest method testSSLClientRequestOptionsSetClear.
@Test
public // Client trusts all server certs
void testSSLClientRequestOptionsSetClear() throws Exception {
RequestOptions options = new RequestOptions().setHost(DEFAULT_HTTP_HOST).setURI(DEFAULT_TEST_URI).setPort(4043).setSsl(false);
testTLS(Cert.NONE, Trust.SERVER_JKS, Cert.SERVER_JKS, Trust.NONE).clientSSL(true).serverSSL(false).requestOptions(options).pass();
}
Aggregations