@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(303).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(); }
@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(303).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(); } }
@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(303).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(); }
@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(303).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(); } }