diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java index a953161d94..157ea5268b 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java @@ -135,8 +135,7 @@ public class ServerUtil { public static boolean waitForServerToStart(String uri, String username, String password, long timeout) throws InterruptedException { long realTimeout = System.currentTimeMillis() + timeout; while (System.currentTimeMillis() < realTimeout) { - try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null)) { - cf.createConnection(username, password).close(); + try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null); Connection c = cf.createConnection(username, password)) { System.out.println("server " + uri + " started"); } catch (Exception e) { System.out.println("awaiting server " + uri + " start at ");