public void AddEventCallbacks(Action <IPEndPoint, DataPacket, Action> onReceivePacket, Func <IPEndPoint, bool> onConnect, Action <IPEndPoint, IDisconnectInfo> onDisconnect)
        {
            if (onConnect == null)
            {
                throw new NullReferenceException($"{nameof(onConnect)} arg is null");
            }
            if (onReceivePacket == null)
            {
                throw new NullReferenceException($"{nameof(onReceivePacket)} arg is null");
            }
            if (onDisconnect == null)
            {
                throw new NullReferenceException($"{nameof(onDisconnect)} arg is null");
            }

            _listener.ConnectionRequestEvent += request =>
            {
                request.AcceptIfKey("SomeConnectionKey333");
            };

            _listener.PeerDisconnectedEvent += (peer, info) =>
            {
                if (peer == null)
                {
                    return;
                }
                _endPointReceivers.TryRemove(peer.EndPoint, out _);
                using (var disconnectInfo = new LiteNetDisconnectInfo(info))
                    onDisconnect(peer.EndPoint, disconnectInfo);
            };

            _listener.NetworkReceiveEvent += (peer, dataReader, method) =>
            {
                var dataPacket = new DataPacket(dataReader.RawData, dataReader.UserDataOffset, dataReader.UserDataSize,
                                                ConvertDeliveryMethod(method));
                onReceivePacket(peer.EndPoint, dataPacket, dataReader.Recycle);
            };

            _listener.PeerConnectedEvent += peer =>
            {
                if (peer == null)
                {
                    throw new NullReferenceException($"Peer arg is null");
                }
                if (onConnect(peer.EndPoint))
                {
                    _endPointReceivers.TryAdd(peer.EndPoint, peer);
                }
            };
        }
        public void Connect(IPEndPoint endPoint)
        {
            _peer.Start();
            _listener.NetworkReceiveEvent += (fromPeer, dataReader, deliveryMethod) =>
            {
                var dataPacket = new DataPacket(dataReader.RawData, dataReader.UserDataOffset, dataReader.UserDataSize,
                                                ConvertDeliveryMethod(deliveryMethod));
                OnPacketReceived?.Invoke(endPoint, dataPacket, dataReader.Recycle);
            };
            _listener.PeerConnectedEvent += peer =>
            {
                _serverPeer = peer;
                OnConnected?.Invoke(peer.EndPoint);
            };

            _listener.PeerDisconnectedEvent += (peer, info) =>
            {
                _serverPeer = null;
                using (var disconnectInfo = new LiteNetDisconnectInfo(info))
                    OnDisconnected?.Invoke(endPoint, disconnectInfo);
            };
            _peer.Connect(endPoint.Address.ToString(), endPoint.Port, "SomeConnectionKey333");
        }