private async Task <IpcEndpointInfo> AcceptAsync(ReversedDiagnosticsServer server)
 {
     using (var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(15)))
     {
         return(await server.AcceptAsync(cancellationSource.Token));
     }
 }
Beispiel #2
0
            public EndpointInfoAccepter(ReversedDiagnosticsServer server, ITestOutputHelper outputHelper)
            {
                _server       = server;
                _outputHelper = outputHelper;

                _listenTask = ListenAsync(_cancellation.Token);
            }
        /// <summary>
        /// Checks that the accepter does not provide a new endpoint info.
        /// </summary>
        private async Task VerifyNoNewEndpointInfos(ReversedDiagnosticsServer server, bool useAsync)
        {
            _outputHelper.WriteLine("Verifying there are no more connections.");

            var shim = new ReversedDiagnosticsServerApiShim(server, useAsync);

            await shim.Accept(DefaultNegativeVerificationTimeout, expectTimeout : true);

            _outputHelper.WriteLine("Verified there are no more connections.");
        }
        /// <summary>
        /// Checks that the accepter does not provide a new endpoint info.
        /// </summary>
        private async Task VerifyNoNewEndpointInfos(ReversedDiagnosticsServer server)
        {
            _outputHelper.WriteLine("Verifying there are no more connections.");

            using var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(1));

            Task acceptTask = server.AcceptAsync(cancellationSource.Token);
            await Assert.ThrowsAsync <TaskCanceledException>(() => acceptTask);

            Assert.True(acceptTask.IsCanceled);

            _outputHelper.WriteLine("Verified there are no more connections.");
        }
        protected TcpServerRouterFactory(string tcpServer, int runtimeTimeoutMs, ILogger logger)
            : base(logger)
        {
            _tcpServerAddress = IpcTcpSocketEndPoint.NormalizeTcpIpEndPoint(string.IsNullOrEmpty(tcpServer) ? "127.0.0.1:0" : tcpServer);

            _auto_shutdown = runtimeTimeoutMs != Timeout.Infinite;
            if (runtimeTimeoutMs != Timeout.Infinite)
            {
                RuntimeTimeoutMs = runtimeTimeoutMs;
            }

            _tcpServer             = new ReversedDiagnosticsServer(_tcpServerAddress, enableTcpIpProtocol: true);
            _tcpServerEndpointInfo = new IpcEndpointInfo();
        }
 public ServerIpcEndpoint(ReversedDiagnosticsServer server, Guid runtimeId)
 {
     _runtimeId = runtimeId;
     _server    = server;
 }
 public ReversedDiagnosticsServerApiShim(ReversedDiagnosticsServer server, bool useAsync)
 {
     _server   = server;
     _useAsync = useAsync;
 }
        private async Task <IpcEndpointInfo> AcceptEndpointInfo(ReversedDiagnosticsServer server, bool useAsync)
        {
            var shim = new ReversedDiagnosticsServerApiShim(server, useAsync);

            return(await shim.Accept(DefaultPositiveVerificationTimeout));
        }