Console chat in Java from a tutorial http://www.dreamincode.net/forums/topic/259777-a-simple-chat-program-with-clientserver-gui-optional/