private void HandleConnect(int connectionId, byte error)
        {
            if (_connectionId != connectionId)
            {
                return;
            }

            _isConnectionPending = false;

            IsConnecting = false;
            IsConnected  = true;

            Status = ConnectionStatus.Connected;

            if (_serverPeer != null)
            {
                _serverPeer.MessageReceived -= HandleMessage;
            }

            _serverPeer = new PeerUnet(connectionId, _socketId);
            Peer        = _serverPeer;
            _serverPeer.SetIsConnected(true);
            _serverPeer.MessageReceived += HandleMessage;

            if (Connected != null)
            {
                Connected.Invoke();
            }
        }
        private void HandleConnect(int connectionId, byte error)
        {
            if (error != 0)
            {
                Logs.Error(string.Format("Error on ConnectEvent. ConnectionId: {0}, error: {1}", connectionId, error));
                return;
            }

            var peer = new PeerUnet(connectionId, _socketId);

            peer.SetIsConnected(true);
            _connectedPeers.Add(connectionId, peer);

            peer.SetIsConnected(true);

            if (Connected != null)
            {
                Connected.Invoke(peer);
            }
        }