Ejemplo n.º 1
0
        public void TestThatServerClosesChannelAfterSingleRequest()
        {
            var totalResponses = 0;
            var maxRequests    = 10;

            for (var count = 0; count < maxRequests; ++count)
            {
                var consumeCalls = _progress.ExpectConsumeTimes(1);
                if (count % 2 == 0)
                {
                    _client.RequestWith(ToStream(PostRequestCloseFollowing(UniqueJohnDoe())).ToArray());
                }
                else
                {
                    _client.RequestWith(ToStream(PostRequestCloseFollowing(UniqueJaneDoe())).ToArray());
                }
                while (consumeCalls.TotalWrites < 1)
                {
                    _client.ProbeChannel();
                }
                totalResponses += consumeCalls.ReadFrom <int>("completed");

                _client.Close();

                _client = new BasicClientRequestResponseChannel(
                    Address.From(Host.Of("localhost"), _serverPort, AddressType.None), _consumer, 100, 10240, World.DefaultLogger);
            }

            Assert.Equal(maxRequests, totalResponses);
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     _client.Close();
     _server.ShutDown();
     Thread.Sleep(200);
     _world.Terminate();
 }
Ejemplo n.º 3
0
        public override void Dispose()
        {
            _client.Close();
            _server.ShutDown();

            base.Dispose();
        }
Ejemplo n.º 4
0
        public void Dispose()
        {
            try
            {
                Thread.Sleep(1000);
            }
            catch
            {
                // ignore
            }

            _server.Close();
            _client.Close();
            _buffer.Dispose();

            _world.Terminate();
        }
Ejemplo n.º 5
0
 public override void Stop()
 {
     _cancellable.Cancel();
     _channel.Close();
     base.Stop();
 }
Ejemplo n.º 6
0
        public void Dispose()
        {
            _client.Close();

            _world.Terminate();
        }