activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6168
Date Fri, 12 Feb 2016 17:36:45 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 3e4bf2df7 -> adf70bc08


https://issues.apache.org/jira/browse/AMQ-6168

Disconnect on unkown STOMP Command Action. 

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/adf70bc0
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/adf70bc0
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/adf70bc0

Branch: refs/heads/master
Commit: adf70bc08ab4a8c3bfa87e0a7b50476aa5bab779
Parents: 3e4bf2d
Author: Timothy Bish <tabish121@gmail.com>
Authored: Fri Feb 12 12:36:19 2016 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Fri Feb 12 12:36:39 2016 -0500

----------------------------------------------------------------------
 .../transport/stomp/ProtocolConverter.java      |  2 +-
 .../activemq/transport/stomp/StompTest.java     | 26 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/adf70bc0/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
----------------------------------------------------------------------
diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
index bcf4714..0164731 100644
--- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
+++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
@@ -266,7 +266,7 @@ public class ProtocolConverter {
             } else if (action.startsWith(Stomp.Commands.DISCONNECT)) {
                 onStompDisconnect(command);
             } else {
-                throw new ProtocolException("Unknown STOMP action: " + action);
+                throw new ProtocolException("Unknown STOMP action: " + action, true);
             }
 
         } catch (ProtocolException e) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/adf70bc0/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
----------------------------------------------------------------------
diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
index 6d46ddf..e895fd1 100644
--- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
+++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
@@ -324,6 +324,32 @@ public class StompTest extends StompTestSupport {
     }
 
     @Test(timeout = 60000)
+    public void testSendFrameWithInvalidAction() throws Exception {
+
+        String frame = "CONNECT\n" + "login:system\n" + "passcode:manager\n\n" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
+
+        frame = stompConnection.receiveFrame();
+        assertTrue(frame.startsWith("CONNECTED"));
+
+        final int connectionCount = getProxyToBroker().getCurrentConnectionsCount();
+
+        frame = "SED\n" + "AMQ_SCHEDULED_DELAY:2000\n"  + "destination:/queue/" + getQueueName()
+ "\n\n" + "Hello World" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
+
+        frame = stompConnection.receiveFrame();
+        assertTrue(frame.startsWith("ERROR"));
+
+        assertTrue("Should drop connection", Wait.waitFor(new Wait.Condition() {
+
+            @Override
+            public boolean isSatisified() throws Exception {
+                return connectionCount > getProxyToBroker().getCurrentConnectionsCount();
+            }
+        }));
+    }
+
+    @Test(timeout = 60000)
     public void testReceipts() throws Exception {
 
         StompConnection receiver = new StompConnection();


Mime
View raw message