Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ public void testEnsureConnected() throws IOException, InterruptedException {
assertFalse(connectionManager.nodeConnected(seedNode));
assertFalse(connectionManager.nodeConnected(discoverableNode));
assertTrue(connection.assertNoRunningConnections());
CountDownLatch latch = new CountDownLatch(1);
CountDownLatch firstLatch = new CountDownLatch(1);
connection.ensureConnected(new LatchedActionListener<>(new ActionListener<Void>() {
@Override
public void onResponse(Void aVoid) {
Expand All @@ -1180,12 +1180,13 @@ public void onResponse(Void aVoid) {
public void onFailure(Exception e) {
throw new AssertionError(e);
}
}, latch));
latch.await();
}, firstLatch));
firstLatch.await();
assertTrue(connectionManager.nodeConnected(seedNode));
assertTrue(connectionManager.nodeConnected(discoverableNode));
assertTrue(connection.assertNoRunningConnections());

CountDownLatch secondLatch = new CountDownLatch(1);
// exec again we are already connected
connection.ensureConnected(new LatchedActionListener<>(new ActionListener<Void>() {
@Override
Expand All @@ -1196,8 +1197,8 @@ public void onResponse(Void aVoid) {
public void onFailure(Exception e) {
throw new AssertionError(e);
}
}, latch));
latch.await();
}, secondLatch));
secondLatch.await();
assertTrue(connectionManager.nodeConnected(seedNode));
assertTrue(connectionManager.nodeConnected(discoverableNode));
assertTrue(connection.assertNoRunningConnections());
Expand Down