protected async void handshake(NetworkStream sns) { HandShakeProtocol handshakeProtocol = new HandShakeProtocol(); await Task.Yield(); AProtocol protocol = await handshakeProtocol.HandShakeServer(sns); if (protocol == null) { disconnect(sns, "Handshake fail."); } else { sns.PROTOCOL = protocol; await sns.SendCommandAsync(GetGameTypeCommand(Battlefield)); if (!Battlefield.AddRobot(sns)) { disconnect(sns, "Arena is full."); } } }