Skip to content

Commit 892a40e

Browse files
author
Achim Kraus
committed
Fix race condition in test.
Ensure, that session is resumed before sending more notifications. When fixing issue SeleniumHQ#23, an additional test should be added to ensure, that notifications during the handshake are not lost. Signed-off-by: Achim Kraus <[email protected]>
1 parent b4278fe commit 892a40e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

californium-integration-tests/src/test/java/org/eclipse/californium/integration/test/SecureObserveTest.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
* Achim Kraus (Bosch Software Innovations GmbH) - add tests to ensure, that
1717
* responses/notifies are
1818
* dropped on the server side
19+
* Achim Kraus (Bosch Software Innovations GmbH) - ensure, that session is resumed
20+
* before sending more notifications
21+
* When fixing issue #23, an
22+
* additional test should be added.
1923
******************************************************************************/
2024
package org.eclipse.californium.integration.test;
2125

@@ -237,13 +241,18 @@ public void testSecureObserveServerAddressChangedWithResume() throws Exception {
237241
nat.reassignLocalAddresses();
238242
serverConnector.forceResumeAllSessions();
239243

244+
// trigger handshake
245+
resource.changed("client");
246+
// wait for established session
247+
assertTrue("Missing notifies", handler.waitForLoadCalls(REPEATS + 2, TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS));
248+
240249
for (int i = 0; i < REPEATS; ++i) {
241250
resource.changed("client");
242251
Thread.sleep(50);
243252
}
244253

245254
assertTrue("Missing notifies after address changed",
246-
handler.waitForLoadCalls(REPEATS + REPEATS + 1, TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS));
255+
handler.waitForLoadCalls(REPEATS + REPEATS + 2, TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS));
247256
assertThat("sending response missing", resource.getCurrentResponse(), is(notNullValue()));
248257
assertThat("sending response caused error", resource.getCurrentResponse().getSendError(), is(nullValue()));
249258
}

0 commit comments

Comments
 (0)