예제 #1
0
        public async Task DisposeInitializeFailedChannelAsyncTest()
        {
            const int msPerBucket = 50;
            const int buckets     = 2 * 1000 / msPerBucket + 1;
            const int seconds     = 10;
            Random    r           = new Random(RntbdTests.RandomSeed());
            Stopwatch sw          = Stopwatch.StartNew();
            TimeSpan  runTime     = TimeSpan.FromSeconds(seconds);

            while (sw.Elapsed < runTime)
            {
                Guid activityId = Guid.NewGuid();
                Trace.CorrelationManager.ActivityId = activityId;
                // Assuming that this machine isn't running SMTP.
                using (Rntbd.Channel channel = new Rntbd.Channel(
                           new Uri("rntbd://localhost:25"),
                           new Rntbd.ChannelProperties(
                               new UserAgentContainer(),
                               certificateHostNameOverride: null,
                               timerPool: new TimerPool(1),
                               requestTimeout: TimeSpan.FromSeconds(1.0),
                               openTimeout: TimeSpan.FromSeconds(1.0),
                               maxChannels: ushort.MaxValue,
                               maxRequestsPerChannel: 100,
                               receiveHangDetectionTime: TimeSpan.FromSeconds(2.0),
                               sendHangDetectionTime: TimeSpan.FromSeconds(0.5))))
                {
                    channel.Initialize(activityId);
                    await Task.Delay(r.Next(1, buckets) *msPerBucket);
                }
            }
        }
예제 #2
0
        public async Task DisposeInitializeFailedChannelAsyncTest()
        {
            const int msPerBucket = 50;
            const int buckets     = 2 * 1000 / msPerBucket + 1;
            const int seconds     = 10;
            Random    r           = new Random(RntbdTests.RandomSeed());
            Stopwatch sw          = Stopwatch.StartNew();
            TimeSpan  runTime     = TimeSpan.FromSeconds(seconds);

            while (sw.Elapsed < runTime)
            {
                Guid activityId = Guid.NewGuid();
                Trace.CorrelationManager.ActivityId = activityId;
                // Assuming that this machine isn't running SMTP.
                using (Rntbd.Channel channel = new Rntbd.Channel(
                           new Uri("rntbd://localhost:25"),
                           RntbdTests.GetChannelProperties()))
                {
                    channel.Initialize(activityId);
                    await Task.Delay(r.Next(1, buckets) *msPerBucket);
                }
            }
        }