Exemplo n.º 1
0
        public async Task CreateClient_ShouldAcceptIncomingClient()
        {
            var client = await _socketManager.CreateClient();

            _listener.VerifyAccept();
            Assert.NotNull(client);
        }
Exemplo n.º 2
0
        public async Task Setup()
        {
            while (!_cts.IsCancellationRequested)
            {
                var client = await _socketManager.CreateClient();

                var pipe       = CreatePipe(client);
                var connection = new TConnection {
                    Pipe = pipe, Parser = _frameParser
                };

                await OnClientAccepted(connection);

                _ = connection.Setup()
                    .ContinueWith(t => _onError(t.Exception?.InnerException),
                                  TaskContinuationOptions.OnlyOnFaulted)
                    .ContinueWith(t => _socketManager.DestroyClient(client),
                                  TaskContinuationOptions.ExecuteSynchronously);
            }
        }