コード例 #1
0
        public void Setup()
        {
            _serverUri = new Uri("tcp://localhost:4312");

            var jsonNetSerializer = new JsonNetSerializer();

            var solarWindHubOptions = new SolarWindHubOptions(TestContext.LoggerFactory);

            _server = new SolarWindHub(solarWindHubOptions);

            _server.Listen(new ServerOptions(_serverUri, _ => new ChannelOptions(jsonNetSerializer, OnServerCallback), delegate { }));

            var clientOptions = new SolarWindHubOptions(TestContext.LoggerFactory);

            _client          = new SolarWindHub(clientOptions);
            _channelToServer = _client.OpenChannelTo(_serverUri, new ChannelOptions(jsonNetSerializer, OnClientCallback));

            _serverReceivedMessage = new ManualResetEvent(false);
            _clientReceivedMessage = new ManualResetEvent(false);
        }
コード例 #2
0
        public void Setup()
        {
            _serverUri = new Uri("tcp://localhost:4312");
            _endpoint  = new IPEndPoint(IPAddress.Loopback, _serverUri.Port);
            var jsonNetSerializer = new JsonNetSerializer();

            _listener = Build.TcpIPv4();
            _listener.Bind(_endpoint);
            _listener.Listen(10);
            Task.Run(StartListener);

            var clientOptions = new SolarWindHubOptions(TestContext.LoggerFactory);

            _client          = new SolarWindHub(clientOptions);
            _channelToServer = _client.OpenChannelTo(_serverUri, new ChannelOptions(jsonNetSerializer, delegate { }));

            _count = 1_000_000;

            _serverReceived = 0;

            _allMessagesReceived = new ManualResetEvent(false);
        }