activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1362035 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java test/java/org/apache/activemq/transport/stomp/StompTelnetTest.java
Date Mon, 16 Jul 2012 13:49:32 GMT
Author: tabish
Date: Mon Jul 16 13:49:31 2012
New Revision: 1362035

URL: http://svn.apache.org/viewvc?rev=1362035&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3927 

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTelnetTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java?rev=1362035&r1=1362034&r2=1362035&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
Mon Jul 16 13:49:31 2012
@@ -661,7 +661,7 @@ public class ProtocolConverter {
             heartBeat = defaultHeartBeat;
         }
 
-        HashSet<String> acceptsVersions = new HashSet<String>(Arrays.asList(accepts.split(Stomp.COMMA)));
+        HashSet<String> acceptsVersions = new HashSet<String>(Arrays.asList(accepts.trim().split(Stomp.COMMA)));
         acceptsVersions.retainAll(Arrays.asList(Stomp.SUPPORTED_PROTOCOL_VERSIONS));
         if (acceptsVersions.isEmpty()) {
             throw new ProtocolException("Invalid Protocol version[" + accepts +"], supported
versions are: " +
@@ -670,7 +670,7 @@ public class ProtocolConverter {
             this.version = Collections.max(acceptsVersions);
         }
 
-        configureInactivityMonitor(heartBeat);
+        configureInactivityMonitor(heartBeat.trim());
 
         IntrospectionSupport.setProperties(connectionInfo, headers, "activemq.");
         connectionInfo.setConnectionId(connectionId);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTelnetTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTelnetTest.java?rev=1362035&r1=1362034&r2=1362035&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTelnetTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTelnetTest.java
Mon Jul 16 13:49:31 2012
@@ -60,6 +60,23 @@ public class StompTelnetTest extends Com
         }
     }
 
+    public void testCRLF11() throws Exception {
+
+        for (TransportConnector connector : broker.getTransportConnectors()) {
+            LOG.info("try: " + connector.getConnectUri());
+
+            StompConnection stompConnection = new StompConnection();
+            stompConnection.open(createSocket(connector.getConnectUri()));
+            String frame = "CONNECT\r\naccept-version:1.1\r\n\r\n" + Stomp.NULL;
+            stompConnection.sendFrame(frame);
+
+            frame = stompConnection.receiveFrame();
+            LOG.info("response from: " + connector.getConnectUri() + ", " + frame);
+            assertTrue(frame.startsWith("CONNECTED"));
+            stompConnection.close();
+        }
+    }
+
     protected Socket createSocket(URI connectUri) throws IOException {
         return new Socket("127.0.0.1", connectUri.getPort());
     }



Mime
View raw message