From 612a70b5be152e4ba165367bbcc1fea58f2ee982 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sun, 16 Feb 2020 22:17:13 +0100 Subject: [PATCH] =?UTF-8?q?Issue=20#4518=20-=C2=A0Add=20a=20mechanism=20th?= =?UTF-8?q?at=20allows=20running=20multiple=20protocols=20on=20the=20same?= =?UTF-8?q?=20port.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed tests after merge. Signed-off-by: Simone Bordet --- .../jetty/server/DetectorConnectionTest.java | 30 +++++++------------ .../server/OptionalSslConnectionTest.java | 3 +- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/DetectorConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/DetectorConnectionTest.java index 79bb28fecc2..f83212104bc 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/DetectorConnectionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/DetectorConnectionTest.java @@ -92,11 +92,10 @@ public class DetectorConnectionTest private String getResponseOverSsl(String request) throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); sslContextFactory.start(); SSLSocketFactory socketFactory = sslContextFactory.getSslContext().getSocketFactory(); @@ -222,11 +221,10 @@ public class DetectorConnectionTest @Test public void testDetectingSslProxyToHttpNoSslWithProxy() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol()); @@ -251,11 +249,10 @@ public class DetectorConnectionTest @Test public void testDetectingSslProxyToHttpWithSslNoProxy() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol()); @@ -276,11 +273,10 @@ public class DetectorConnectionTest @Test public void testDetectingSslProxyToHttpWithSslWithProxy() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol()); @@ -303,11 +299,10 @@ public class DetectorConnectionTest @Test public void testDetectionUnsuccessfulUpgradesToNextProtocol() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol()); @@ -328,11 +323,10 @@ public class DetectorConnectionTest @Test void testDetectorToNextDetector() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol()); @@ -394,11 +388,10 @@ public class DetectorConnectionTest @Test void testDetectorWithProxyThatHasNoNextProto() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); ProxyConnectionFactory proxy = new ProxyConnectionFactory(); @@ -421,11 +414,10 @@ public class DetectorConnectionTest @Test void testOptionalSsl() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConnectionFactory http = new HttpConnectionFactory(); SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, http.getProtocol()); @@ -449,11 +441,10 @@ public class DetectorConnectionTest @Test void testDetectorThatHasNoConfiguredNextProto() throws Exception { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()); DetectorConnectionFactory detector = new DetectorConnectionFactory(ssl); @@ -621,11 +612,10 @@ public class DetectorConnectionTest @Test void testGeneratedProtocolNames() { - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); ProxyConnectionFactory proxy = new ProxyConnectionFactory(HttpVersion.HTTP_1_1.asString()); SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/OptionalSslConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/OptionalSslConnectionTest.java index 6f2d0cf0402..9135a4f0ba2 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/OptionalSslConnectionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/OptionalSslConnectionTest.java @@ -211,11 +211,10 @@ public class OptionalSslConnectionTest serverThreads.setName("server"); server = new Server(serverThreads); - String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); + String keystore = MavenTestingUtils.getTestResourceFile("keystore.p12").getAbsolutePath(); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystore); sslContextFactory.setKeyStorePassword("storepwd"); - sslContextFactory.setKeyManagerPassword("keypwd"); HttpConfiguration httpConfig = new HttpConfiguration(); HttpConnectionFactory http = new HttpConnectionFactory(httpConfig);