예제 #1
0
 public void Setup()
 {
     _cbs        = new MockSmartCallbacks();
     _bareSock   = new MockSock();
     _bufferPool = new ByteBufferPool();
     _sock       = new SmartSock(_bufferPool, _bareSock, _cbs);
 }
예제 #2
0
 public void Setup()
 {
     _cbs             = new MockSmartCallbacks();
     _bareSock        = new MockSock();
     _bufferPool      = new MockBufferPool();
     _threadSmartSock = new ThreadSmartSock(_bufferPool, _bareSock, _cbs);
 }
예제 #3
0
 public void Setup()
 {
     _cbs            = new MockSmartCallbacks();
     _bareSock       = new MockSock();
     _bufferPool     = new ByteBufferPool();
     _sock           = new SmartSock(_bufferPool, _bareSock, _cbs);
     _remoteEndPoint = new IPEndPoint(IPAddress.Loopback, 23452);
 }
예제 #4
0
        public void Setup()
        {
            _cbs        = new MockSmartCallbacks();
            _bareSock   = new MockSock();
            _bufferPool = new ByteBufferPool();
            _sock       = new SmartSock(_bufferPool, _bareSock, _cbs);
            _endPoint   = new IPEndPoint(IPAddress.Loopback, 23452);

            Utils.SendConnectRequest(_bareSock, _endPoint, _bufferPool);
        }
예제 #5
0
        public static void SendConnectRequest(MockSock bareSock, IPEndPoint endPoint, BufferPoolBase bufferPool)
        {
            var header = new PacketHeader();

            header.SetSessionId(PacketHeader.EmptySessionId);
            header.SetConnect();

            var buffer = bufferPool.Get(header.HeaderLength);

            header.Length = (ushort)header.HeaderLength;
            header.WriteTo(buffer, 0);

            bareSock.FakeReceive(buffer, 0, header.HeaderLength, endPoint);
        }
예제 #6
0
        public static void SendDisconnectResponse(MockSock bareSock, IPEndPoint endPoint, BufferPoolBase bufferPool)
        {
            ushort sessionId = 427;
            var    header    = new PacketHeader();

            header.SetSessionId(sessionId);
            header.SetDisconnect();

            var buffer = bufferPool.Get(header.HeaderLength);

            header.Length = (ushort)header.HeaderLength;
            header.WriteTo(buffer, 0);

            bareSock.FakeReceive(buffer, 0, header.HeaderLength, endPoint);
        }
예제 #7
0
 public static void SendDisconnectRequest(MockSock bareSock, IPEndPoint endPoint, BufferPoolBase bufferPool)
 {
     SendDisconnectResponse(bareSock, endPoint, bufferPool);
 }