diff --git a/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java b/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java index b7e7d62a1e..6c99328fd2 100644 --- a/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java +++ b/activemq-optional/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java @@ -245,6 +245,15 @@ public class WSTransportTest { return webReceived.getText().equals("messages #" + MESSAGE_COUNT); } })); + + Thread.sleep(1000); + + assertTrue("Should have disconnected", Wait.waitFor(new Wait.Condition() { + + public boolean isSatisified() throws Exception { + return webStatus.getText().equals("Disconnected"); + } + })); } } } diff --git a/activemq-optional/src/test/webapp/websocket.html b/activemq-optional/src/test/webapp/websocket.html index b3ee712996..1b0e3a01cf 100644 --- a/activemq-optional/src/test/webapp/websocket.html +++ b/activemq-optional/src/test/webapp/websocket.html @@ -48,6 +48,11 @@ $("#status").html("Connected"); client.subscribe(destination, function(message) { $("#received").html(message.body); + if (message.body == "messages #1000") { + client.disconnect(function() { + $("#status").html("Disconnected"); + }); + } }); }); } else {