Please read this sentence again:
Topics are different than queues - only listeners who are registered at the time that a message is posted to a topic will received the message.
Then look at your test code and tell me why it does not work.
Your consumer is a little trickier - you will have to read the javadocs for the MessageConsumer.receive() method before you can tell me why it doesn't work.