コード例 #1
0
        public void Dispose()
        {
            _listener?.Dispose();
            _listener = null;

            var clients = _cluster.GetSnapshot();

            foreach (var client in clients)
            {
                client.Dispose();
            }
            _cluster.Clear();
            _cluster = null;
        }
コード例 #2
0
 public SocketManager(ISocketListener socketListener, ISocketCluster mainCluster)
 {
     _listener = socketListener ?? throw new ArgumentNullException(nameof(socketListener));
     _cluster  = mainCluster ?? throw new ArgumentNullException(nameof(mainCluster));
 }
コード例 #3
0
 public SocketManager(int backlog, EndPoint endPoint, SocketFactory sf, ISocketCluster mainCluster)
 {
     _listener = sf?.CreateListenerSocket(endPoint, backlog) ?? throw new ArgumentNullException(nameof(sf));
     _cluster  = mainCluster ?? throw new ArgumentNullException(nameof(mainCluster));
 }
コード例 #4
0
 public SocketServerTests()
 {
     _cluster      = new SocketCluster(1000);
     _socketServer = new FakeSocketServer(_cluster);
 }
コード例 #5
0
 public SocketManagerTests()
 {
     _listener      = new MockSocketProxy();
     _socketCluster = new SocketCluster(1000);
     _socketManager = new SocketManager(_listener, _socketCluster);
 }
コード例 #6
0
 public FakeSocketServer(ISocketCluster cluster, Action <Exception> onError = default)
     : base(new SocketManager(new MockSocketProxy(), cluster),
            new FakeFrameParser(),
            onError)
 {
 }