Bug fixes for client encryption

Check the client can connect to the simulation server. Fixed a few bugs
involved in changing the message size from a short to an int, and
corrected a mistake in the simulationservergateway code.