Reconnect test fails easier now

This commit is contained in:
nathan 2019-01-25 16:14:00 +01:00
parent 8c9140b3f6
commit e6cc3fd851

View File

@ -141,6 +141,7 @@ class ReconnectTest extends BaseTest {
if (useTCP && useUDP) { if (useTCP && useUDP) {
initialCount += 2; initialCount += 2;
} }
try {
for (int i = 1; i < count + 1; i++) { for (int i = 1; i < count + 1; i++) {
System.out.println("....."); System.out.println(".....");
try { try {
@ -149,9 +150,9 @@ class ReconnectTest extends BaseTest {
e.printStackTrace(); e.printStackTrace();
} }
int waitingRetryCount = 20; int waitingRetryCount = 20;
int target = i * initialCount; int target = i * initialCount;
boolean failed = false;
synchronized (receivedCount) { synchronized (receivedCount) {
while (this.receivedCount.get() != target) { while (this.receivedCount.get() != target) {
@ -167,8 +168,10 @@ class ReconnectTest extends BaseTest {
System.err.println("NOTE: UDP can fail, even on loopback! See: http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM"); System.err.println("NOTE: UDP can fail, even on loopback! See: http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM");
} }
stopEndPoints(); if (target != this.receivedCount.get()) {
assertEquals(target, this.receivedCount.get()); failed = true;
break;
}
} }
try { try {
receivedCount.wait(1000); receivedCount.wait(1000);
@ -180,13 +183,19 @@ class ReconnectTest extends BaseTest {
client.close(); client.close();
System.out.println("....."); System.out.println(".....");
if (failed) {
break;
}
} }
assertEquals(count * initialCount, this.receivedCount.get()); assertEquals(count * initialCount, this.receivedCount.get());
} finally {
stopEndPoints(); stopEndPoints();
waitForThreads(10); waitForThreads(10);
} }
}
@Test @Test
public public