private void OnServerConnected(SocketerClient client, int sourceId, string clientAddress)
        {
            Debug.Log("Server connected to " + clientAddress);
            TCPNetworkConnection connection = new TCPNetworkConnection(client, clientAddress, sourceId);

            serverConnections[sourceId] = connection;
            connection.SetIncomingMessageQueue(inputMessageQueue);
            newConnections.Enqueue(connection);
        }
        private void OnClientConnected(SocketerClient client, int sourceId, string hostAddress)
        {
            Debug.Log("Client connected to " + hostAddress);
            TCPNetworkConnection connection = new TCPNetworkConnection(client, hostAddress, sourceId);

            if (!AttemptReconnectWhenClient)
            {
                connection.StopConnectionAttempts();
            }

            clientConnection = connection;
            connection.SetIncomingMessageQueue(inputMessageQueue);
            newConnections.Enqueue(connection);
        }
        private void OnClientDisconnected(SocketerClient client, int sourceId, string hostAddress)
        {
            if (clientConnection != null)
            {
                Debug.Log("Client disconnected");
                clientConnection.SetIncomingMessageQueue(null);
                oldConnections.Enqueue(clientConnection);
                clientConnection = null;
            }

            if (!AttemptReconnectWhenClient)
            {
                Debug.Log("Stopping subscriptions to disconnected client");
                client.Stop();
                client.Connected    -= OnClientConnected;
                client.Disconnected -= OnClientDisconnected;

                if (this.client == client)
                {
                    Debug.Log("Clearing client cache");
                    this.client = null;
                }
            }
        }