protected override void CheckRequest() { _request.Parse(); string key = _session.RemoteEndPoint.ToString() + "-" + _request.PortType.ToString(); if (!NNManager.SessionPool.TryGetValue(key, out _)) { NNManager.SessionPool.TryAdd(key, _session); } }
public void InitTest() { var rawRequest = new byte[] { 0xfd, 0xfc, 0x1e, 0x66, 0x6a, 0xb2, 0x03, 0x00, 0x00, 0x00, 0x03, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; var request = new InitRequest(rawRequest); request.Parse(); Assert.Equal(RequestType.Init, request.CommandName); Assert.Equal((uint)151191552, request.Cookie); Assert.Equal(NatClientIndex.GameClient, request.ClientIndex); Assert.Equal((byte)0, request.UseGamePort); Assert.Equal((byte)3, request.Version); Assert.Equal((byte)0, request.UseGamePort); Assert.Equal(NatPortType.NN1, request.PortType); }