Update Client.java to synchronize packet write.