Skip to content

Commit 161577d

Browse files
committed
Adapt test code to Java 6
(cherry picked from commit c64b7d0)
1 parent a78a897 commit 161577d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/test/java/com/rabbitmq/tools/Host.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static Process invokeMakeTarget(String command) throws IOException {
133133

134134
public static void startRabbitOnNode() throws IOException {
135135
rabbitmqctl("start_app");
136-
tryConnectFor(10_000);
136+
tryConnectFor(10 * 000);
137137
}
138138

139139
public static void stopRabbitOnNode() throws IOException {
@@ -151,11 +151,13 @@ public static void tryConnectFor(int timeoutInMs) throws IOException {
151151
}
152152
totalWaitTime += waitTime;
153153
ConnectionFactory connectionFactory = TestUtils.connectionFactory();
154-
try (Connection ignored = connectionFactory.newConnection()) {
155-
return;
156-
154+
Connection c = null;
155+
try {
156+
c = connectionFactory.newConnection();
157157
} catch (Exception e) {
158158
// retrying
159+
} finally {
160+
TestUtils.close(c);
159161
}
160162
}
161163
throw new IOException("Could not connect to broker for " + timeoutInMs + " ms");

0 commit comments

Comments
 (0)