Github user jbertram commented on the issue: https://github.com/apache/activemq-artemis/pull/2491 The test code is correct. The state kept in an unclean session includes the subscriptions which is why the test doesn't create a subscription before trying to receive the message. If the broker doesn't properly clean the session state when the client connects with cleanSession=true then it will receive a message and the test will fail.
---