From 60e31710765cdf3ac48a97217b84b41960922ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Wed, 20 Nov 2024 21:55:55 +0100 Subject: [PATCH] [java] close the running Server in unittests if a retry is needed --- .../environment/webserver/NettyAppServer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/java/test/org/openqa/selenium/environment/webserver/NettyAppServer.java b/java/test/org/openqa/selenium/environment/webserver/NettyAppServer.java index 04316b0e451d8..2ff06b6dfcd12 100644 --- a/java/test/org/openqa/selenium/environment/webserver/NettyAppServer.java +++ b/java/test/org/openqa/selenium/environment/webserver/NettyAppServer.java @@ -149,7 +149,16 @@ public void start() { () -> { server.start(); if (secure != null) { - secure.start(); + try { + secure.start(); + } catch (Exception e) { + try { + server.stop(); + } catch (Exception ex) { + e.addSuppressed(ex); + throw e; + } + } } }); }