diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java index c6891043b6..2bed68c7ef 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java @@ -165,7 +165,7 @@ public abstract class VersionedStompFrameHandler public StompFrame handleReceipt(String receiptID) { - StompFrame receipt = new StompFrame(Stomp.Responses.RECEIPT); + StompFrame receipt = createStompFrame(Stomp.Responses.RECEIPT); receipt.addHeader(Stomp.Headers.Response.RECEIPT_ID, receiptID); return receipt; diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java index 538427741c..656ed8de46 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java @@ -103,7 +103,8 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements else { // not valid - response = new StompFrame(Stomp.Responses.ERROR, true); + response = createStompFrame(Stomp.Responses.ERROR); + response.setNeedsDisconnect(true); response.addHeader(Stomp.Headers.Error.MESSAGE, "Failed to connect"); response.setBody("The login account is not valid."); } @@ -268,7 +269,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements public StompFrame createPingFrame() { - StompFrame frame = new StompFrame(Stomp.Commands.STOMP); + StompFrame frame = createStompFrame(Stomp.Commands.STOMP); frame.setPing(true); return frame; }