I want to be listening to a server while my program is doing other things, when a message is received from the server I want to interpret it.
I know about threading
Go through some tutorials for understanding Java Threads.
http://www.journaldev.com/1079/java-thread-tutorial
Your problem seems to be like producer-consumer model, you can use BlockingQueue to achieve this task easily.
Java Blocking Queue