git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1362035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-07-16 13:49:31 +00:00
parent c4cdd516a1
commit 0f11d8c3f9
2 changed files with 19 additions and 2 deletions

View File

@ -661,7 +661,7 @@ public class ProtocolConverter {
heartBeat = defaultHeartBeat; 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)); acceptsVersions.retainAll(Arrays.asList(Stomp.SUPPORTED_PROTOCOL_VERSIONS));
if (acceptsVersions.isEmpty()) { if (acceptsVersions.isEmpty()) {
throw new ProtocolException("Invalid Protocol version[" + accepts +"], supported versions are: " + throw new ProtocolException("Invalid Protocol version[" + accepts +"], supported versions are: " +
@ -670,7 +670,7 @@ public class ProtocolConverter {
this.version = Collections.max(acceptsVersions); this.version = Collections.max(acceptsVersions);
} }
configureInactivityMonitor(heartBeat); configureInactivityMonitor(heartBeat.trim());
IntrospectionSupport.setProperties(connectionInfo, headers, "activemq."); IntrospectionSupport.setProperties(connectionInfo, headers, "activemq.");
connectionInfo.setConnectionId(connectionId); connectionInfo.setConnectionId(connectionId);

View File

@ -60,6 +60,23 @@ public class StompTelnetTest extends CombinationTestSupport {
} }
} }
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 { protected Socket createSocket(URI connectUri) throws IOException {
return new Socket("127.0.0.1", connectUri.getPort()); return new Socket("127.0.0.1", connectUri.getPort());
} }