mirror of https://github.com/apache/activemq.git
Disconnect on unkown STOMP Command Action.
This commit is contained in:
parent
3e4bf2df75
commit
adf70bc08a
|
@ -266,7 +266,7 @@ public class ProtocolConverter {
|
||||||
} else if (action.startsWith(Stomp.Commands.DISCONNECT)) {
|
} else if (action.startsWith(Stomp.Commands.DISCONNECT)) {
|
||||||
onStompDisconnect(command);
|
onStompDisconnect(command);
|
||||||
} else {
|
} else {
|
||||||
throw new ProtocolException("Unknown STOMP action: " + action);
|
throw new ProtocolException("Unknown STOMP action: " + action, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ProtocolException e) {
|
} catch (ProtocolException e) {
|
||||||
|
|
|
@ -323,6 +323,32 @@ public class StompTest extends StompTestSupport {
|
||||||
assertEquals("getJMSPriority", 4, message.getJMSPriority());
|
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)
|
@Test(timeout = 60000)
|
||||||
public void testReceipts() throws Exception {
|
public void testReceipts() throws Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue