Disconnect on unkown STOMP Command Action.
This commit is contained in:
Timothy Bish 2016-02-12 12:36:19 -05:00
parent 3e4bf2df75
commit adf70bc08a
2 changed files with 27 additions and 1 deletions

View File

@ -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) {

View File

@ -323,6 +323,32 @@ public class StompTest extends StompTestSupport {
assertEquals("getJMSPriority", 4, message.getJMSPriority());
}
@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 {