Support STOMP in addition to CONNECT frame

One is literally an alias for the other with "the advantage that a
protocol sniffer/discriminator will be able to differentiate the STOMP
connection from an HTTP connection".

Closes gh-22652
This commit is contained in:
Rossen Stoyanchev
2019-03-27 16:19:11 -04:00
parent 50acbae4cf
commit 1aaadb39c0
6 changed files with 20 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -289,7 +289,7 @@ public class StompSubProtocolHandlerTests {
@Test
public void handleMessageFromClient() {
TextMessage textMessage = StompTextMessageBuilder.create(StompCommand.CONNECT).headers(
TextMessage textMessage = StompTextMessageBuilder.create(StompCommand.STOMP).headers(
"login:guest", "passcode:guest", "accept-version:1.1,1.0", "heart-beat:10000,10000").build();
this.protocolHandler.afterSessionStarted(this.session, this.channel);
@@ -307,7 +307,7 @@ public class StompSubProtocolHandlerTests {
assertArrayEquals(new long[] {10000, 10000}, SimpMessageHeaderAccessor.getHeartbeat(actual.getHeaders()));
StompHeaderAccessor stompAccessor = StompHeaderAccessor.wrap(actual);
assertEquals(StompCommand.CONNECT, stompAccessor.getCommand());
assertEquals(StompCommand.STOMP, stompAccessor.getCommand());
assertEquals("guest", stompAccessor.getLogin());
assertEquals("guest", stompAccessor.getPasscode());
assertArrayEquals(new long[] {10000, 10000}, stompAccessor.getHeartbeat());