Beispiel #1
0
 public void Setup()
 {
     _cbs        = new MockSmartCallbacks();
     _bareSock   = new MockSock();
     _bufferPool = new ByteBufferPool();
     _sock       = new SmartSock(_bufferPool, _bareSock, _cbs);
 }
 public void Setup()
 {
     _cbs             = new MockSmartCallbacks();
     _bareSock        = new MockSock();
     _bufferPool      = new MockBufferPool();
     _threadSmartSock = new ThreadSmartSock(_bufferPool, _bareSock, _cbs);
 }
 public void Setup()
 {
     _cbs            = new MockSmartCallbacks();
     _bareSock       = new MockSock();
     _bufferPool     = new ByteBufferPool();
     _sock           = new SmartSock(_bufferPool, _bareSock, _cbs);
     _remoteEndPoint = new IPEndPoint(IPAddress.Loopback, 23452);
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #7
0
 public static void SendDisconnectRequest(MockSock bareSock, IPEndPoint endPoint, BufferPoolBase bufferPool)
 {
     SendDisconnectResponse(bareSock, endPoint, bufferPool);
 }