private static async void ServerEvent(ServerHost host) { var peer = await host.AcceptAsync(); // Client断开,Server端收到Disconnect事件,结束Server线程 peer.PeerEvent.Disconnect += ev => host.Stop(); using (var rPacket = await peer.ReceiveAsync()) { Logger.Debug(rPacket.Bytes.ToStr()); CollectionAssert.AreEqual("0123456789".ToByteArray(), rPacket.Bytes); } using (var sPacket = new Packet("9876543210".ToByteArray(), PacketFlags.Reliable)) { peer.Send(0, sPacket); } }