diff --git a/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java b/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java index f812b7e8b3dc7..4312b6b379dc4 100644 --- a/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java +++ b/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java @@ -209,8 +209,7 @@ public boolean isServiceUp() { // If no status endpoint was configured, we assume the server is up. return true; } - try { - HttpClient client = clientFactory.createClient(serviceStatusUrl); + try (HttpClient client = clientFactory.createClient(serviceStatusUrl)) { HttpResponse response = client.execute(new HttpRequest(HttpMethod.GET, serviceStatusUrl.toString())); LOG.log(Debug.getDebugLogLevel(), () -> Contents.string(response));