small improvement on stomp test
This commit is contained in:
parent
2c4312d4f2
commit
af150b5bea
|
@ -1038,7 +1038,7 @@ public class StompV12Test extends StompV11TestBase {
|
|||
|
||||
Assert.assertEquals("ERROR", frame.getCommand());
|
||||
|
||||
Thread.sleep(1000);
|
||||
waitDisconnect(connV12);
|
||||
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
|
||||
|
||||
//message still there.
|
||||
|
@ -1065,7 +1065,7 @@ public class StompV12Test extends StompV11TestBase {
|
|||
|
||||
System.out.println("Receiver error: " + error);
|
||||
|
||||
Thread.sleep(1000);
|
||||
waitDisconnect(connV12);
|
||||
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
|
||||
|
||||
//message should still there
|
||||
|
@ -1100,7 +1100,7 @@ public class StompV12Test extends StompV11TestBase {
|
|||
|
||||
Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
|
||||
|
||||
Thread.sleep(1000);
|
||||
waitDisconnect(connV12);
|
||||
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
|
||||
|
||||
//message should still there
|
||||
|
@ -1135,7 +1135,7 @@ public class StompV12Test extends StompV11TestBase {
|
|||
|
||||
Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
|
||||
|
||||
Thread.sleep(1000);
|
||||
waitDisconnect(connV12);
|
||||
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
|
||||
|
||||
//message should still there
|
||||
|
@ -1144,6 +1144,14 @@ public class StompV12Test extends StompV11TestBase {
|
|||
Assert.assertNotNull(message);
|
||||
}
|
||||
|
||||
protected void waitDisconnect(StompClientConnectionV12 connection) throws Exception {
|
||||
|
||||
long timeout = System.currentTimeMillis() + 10000;
|
||||
while (timeout > System.currentTimeMillis() && connection.isConnected()) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAckModeClient() throws Exception {
|
||||
connV12.connect(defUser, defPass);
|
||||
|
|
Loading…
Reference in New Issue