You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/09/07 15:44:33 UTC

svn commit: r1166177 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java

Author: tabish
Date: Wed Sep  7 13:44:33 2011
New Revision: 1166177

URL: http://svn.apache.org/viewvc?rev=1166177&view=rev
Log:
add test for: https://issues.apache.org/jira/browse/AMQ-3484

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java?rev=1166177&r1=1166176&r2=1166177&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java Wed Sep  7 13:44:33 2011
@@ -239,6 +239,34 @@ public class Stomp11Test extends Combina
         assertTrue("Broker did close idle connection in time.", (endTime - startTime) >= 1000);
     }
 
+    public void testSendAfterMissingHeartbeat() throws Exception {
+
+        String connectFrame = "STOMP\n" + "login: system\n" +
+                              "passcode: manager\n" +
+                              "accept-version:1.1\n" +
+                              "heart-beat:1000,0\n" +
+                              "host:localhost\n" +
+                              "\n" + Stomp.NULL;
+
+        stompConnection.sendFrame(connectFrame);
+        String f = stompConnection.receiveFrame();
+        assertTrue(f.startsWith("CONNECTED"));
+        assertTrue(f.indexOf("version:1.1") >= 0);
+        assertTrue(f.indexOf("heart-beat:") >= 0);
+        assertTrue(f.indexOf("session:") >= 0);
+        LOG.debug("Broker sent: " + f);
+
+        Thread.sleep(5000);
+
+        try {
+            String message = "SEND\n" + "destination:/queue/" + getQueueName() + "\n\n" + "Hello World" + Stomp.NULL;
+            stompConnection.sendFrame(message);
+            fail("SEND frame has been accepted after missing heart beat");
+        } catch (Exception ex) {
+            System.out.println(ex.getMessage());
+        }
+    }
+
     public void testRejectInvalidHeartbeats1() throws Exception {
 
         String connectFrame = "STOMP\n" +
@@ -542,5 +570,4 @@ public class Stomp11Test extends Combina
         String frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
         stompConnection.sendFrame(frame);
     }
-
 }