Skip to content

Commit 2d4541f

Browse files
committed
It was a bad idea to close server connector :(
1 parent e5d451e commit 2d4541f

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

java/client/test/org/openqa/selenium/environment/webserver/JettyAppServer.java

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -223,38 +223,37 @@ public void start() {
223223
httpConfig.setSecureScheme("https");
224224
httpConfig.setSecurePort(securePort);
225225

226-
try (ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpConfig))) {
227-
http.setPort(port);
228-
http.setIdleTimeout(500000);
229-
230-
Path keystore = getKeyStore();
231-
if (!Files.exists(keystore)) {
232-
throw new RuntimeException(
233-
"Cannot find keystore for SSL cert: " + keystore.toAbsolutePath());
234-
}
235-
236-
SslContextFactory sslContextFactory = new SslContextFactory();
237-
sslContextFactory.setKeyStorePath(keystore.toAbsolutePath().toString());
238-
sslContextFactory.setKeyStorePassword("password");
239-
sslContextFactory.setKeyManagerPassword("password");
240-
241-
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
242-
httpsConfig.addCustomizer(new SecureRequestCustomizer());
243-
244-
ServerConnector https = new ServerConnector(
245-
server,
246-
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
247-
new HttpConnectionFactory(httpsConfig));
248-
https.setPort(securePort);
249-
https.setIdleTimeout(500000);
250-
251-
server.setConnectors(new Connector[]{http, https});
252-
253-
try {
254-
server.start();
255-
} catch (Exception e) {
256-
throw new RuntimeException(e);
257-
}
226+
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
227+
http.setPort(port);
228+
http.setIdleTimeout(500000);
229+
230+
Path keystore = getKeyStore();
231+
if (!Files.exists(keystore)) {
232+
throw new RuntimeException(
233+
"Cannot find keystore for SSL cert: " + keystore.toAbsolutePath());
234+
}
235+
236+
SslContextFactory sslContextFactory = new SslContextFactory();
237+
sslContextFactory.setKeyStorePath(keystore.toAbsolutePath().toString());
238+
sslContextFactory.setKeyStorePassword("password");
239+
sslContextFactory.setKeyManagerPassword("password");
240+
241+
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
242+
httpsConfig.addCustomizer(new SecureRequestCustomizer());
243+
244+
ServerConnector https = new ServerConnector(
245+
server,
246+
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
247+
new HttpConnectionFactory(httpsConfig));
248+
https.setPort(securePort);
249+
https.setIdleTimeout(500000);
250+
251+
server.setConnectors(new Connector[]{http, https});
252+
253+
try {
254+
server.start();
255+
} catch (Exception e) {
256+
throw new RuntimeException(e);
258257
}
259258
}
260259

0 commit comments

Comments
 (0)