Skip to content

Commit

Permalink
Allow for the connection to close without getting the ERROR frame
Browse files Browse the repository at this point in the history
  • Loading branch information
tabish121 committed Jun 16, 2016
1 parent c071341 commit 5ba8679
Showing 1 changed file with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,15 @@ public void testRejectInvalidHeartbeats1() throws Exception {
"\n" + Stomp.NULL;
wsStompConnection.sendRawFrame(connectFrame);

String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS);
try {
String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS);

assertTrue(incoming.startsWith("ERROR"));
assertTrue(incoming.indexOf("heart-beat") >= 0);
assertTrue(incoming.indexOf("message:") >= 0);
assertTrue(incoming.startsWith("ERROR"));
assertTrue(incoming.indexOf("heart-beat") >= 0);
assertTrue(incoming.indexOf("message:") >= 0);
} catch (IOException ex) {
LOG.debug("Connection closed before Frame was read.");
}

assertTrue("Connection should close", Wait.waitFor(new Wait.Condition() {

Expand All @@ -171,11 +175,15 @@ public void testRejectInvalidHeartbeats2() throws Exception {
"\n" + Stomp.NULL;
wsStompConnection.sendRawFrame(connectFrame);

String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS);
try {
String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS);

assertTrue(incoming.startsWith("ERROR"));
assertTrue(incoming.indexOf("heart-beat") >= 0);
assertTrue(incoming.indexOf("message:") >= 0);
assertTrue(incoming.startsWith("ERROR"));
assertTrue(incoming.indexOf("heart-beat") >= 0);
assertTrue(incoming.indexOf("message:") >= 0);
} catch (IOException ex) {
LOG.debug("Connection closed before Frame was read.");
}

assertTrue("Connection should close", Wait.waitFor(new Wait.Condition() {

Expand All @@ -197,11 +205,15 @@ public void testRejectInvalidHeartbeats3() throws Exception {
"\n" + Stomp.NULL;
wsStompConnection.sendRawFrame(connectFrame);

String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS);
try {
String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS);

assertTrue(incoming.startsWith("ERROR"));
assertTrue(incoming.indexOf("heart-beat") >= 0);
assertTrue(incoming.indexOf("message:") >= 0);
assertTrue(incoming.startsWith("ERROR"));
assertTrue(incoming.indexOf("heart-beat") >= 0);
assertTrue(incoming.indexOf("message:") >= 0);
} catch (IOException ex) {
LOG.debug("Connection closed before Frame was read.");
}

assertTrue("Connection should close", Wait.waitFor(new Wait.Condition() {

Expand Down

0 comments on commit 5ba8679

Please sign in to comment.