Updated Connection Management and Message usage

Updated the server side to create message responses depending on the
message being send without the need for message casting or instanceof
usage.

Updated the client side similarly to the server side for handling
messages and updated the client connections to have all writes and reads
contained in a separate function for easier switching if need be