예제 #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()
        {
            _serializer = new JsonNetSerializer();
            var options = new SolarWindHubOptions(TestContext.LoggerFactory);

            _hub = new SolarWindHub(options);
            _uri = new Uri("tcp://localhost:4312");
            _hub.Listen(new ServerOptions(_uri, _ => new ChannelOptions(_serializer, OnCallback), delegate { }));


            var header = new MessageHeader(new MessageTypeId(1), MessageId.Empty, MessageId.Empty);
            var data   = new TextMessage {
                Text = "Greetings"
            };

            _messageBuffer = new MemoryStream();

            _serializer.SerializeMessage(_messageBuffer, in header, data);

            _clientHubId = new HubId("client");
        }