I haven't seen much of that code you referred in your post. But, i guess you just have to change the following line to use the remote host IP/hostname and port to "listen" to messages on a remote topic:
Listener listener = new Listener("remoteIP:1099", "topic/example");
Thanks Jaikiran. Will try that.
Just thought to ask if all i have to do is edit the Listener code and not worry about the sender