Ejemplo n.º 1
0
        public SocketRequestResponseChannelTest(ITestOutputHelper output)
        {
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world = World.StartWithDefaults("test-request-response-channel");

            _buffer = new MemoryStream(1024);
            var logger   = ConsoleLogger.TestInstance();
            var provider = new TestRequestChannelConsumerProvider();

            _serverConsumer = (TestRequestChannelConsumer)provider.Consumer;

            _server = ServerRequestResponseChannelFactory.Start(
                _world.Stage,
                provider,
                _testPort,
                "test-server",
                1,
                PoolSize,
                10240,
                10L);

            _clientConsumer = new TestResponseChannelConsumer();

            _client = new BasicClientRequestResponseChannel(Address.From(Host.Of("localhost"), _testPort, AddressType.None),
                                                            _clientConsumer, PoolSize, 10240, logger);

            ++_testPort;
        }
        public BaseServerChannelTest(ITestOutputHelper output, int poolSize)
        {
            _output   = output;
            _poolSize = poolSize;
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world = World.StartWithDefaults("test-request-response-channel");

            _buffer = new MemoryStream(1024);
            var logger   = ConsoleLogger.TestInstance();
            var provider = new TestRequestChannelConsumerProvider();

            _serverConsumer = (TestRequestChannelConsumer)provider.Consumer;

            var testPort = TestPort.IncrementAndGet();

            _server = GetServer(
                _world.Stage,
                provider,
                "test-server",
                testPort,
                1,
                _poolSize,
                10240,
                10L,
                1L);

            _clientConsumer = new TestResponseChannelConsumer();

            _client = GetClient(_clientConsumer, _poolSize, 10240, testPort, logger);
        }