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

                _listenTask = ListenAsync(_cancellation.Token);
            }
Ejemplo n.º 3
0
        /// <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.");
        }
Ejemplo n.º 4
0
        /// <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();
        }
Ejemplo n.º 6
0
 public ServerIpcEndpoint(ReversedDiagnosticsServer server, Guid runtimeId)
 {
     _runtimeId = runtimeId;
     _server    = server;
 }
Ejemplo n.º 7
0
 public ReversedDiagnosticsServerApiShim(ReversedDiagnosticsServer server, bool useAsync)
 {
     _server   = server;
     _useAsync = useAsync;
 }
Ejemplo n.º 8
0
        private async Task <IpcEndpointInfo> AcceptEndpointInfo(ReversedDiagnosticsServer server, bool useAsync)
        {
            var shim = new ReversedDiagnosticsServerApiShim(server, useAsync);

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