Beispiel #1
0
        public void Dispose_should_dispose_all_connections()
        {
            var channel1 = OpenChannel();
            var channel2 = OpenChannel();

            _subject.Dispose();
            channel1.AssertWasCalled(c => c.Dispose());
            channel2.AssertWasCalled(c => c.Dispose());
            Assert.That(_subject.ActiveConnections, Is.Empty);
        }
        public void ValidateIpEndPointProvision()
        {
            connectionListener = new LidgrenServerConnectionListener(applicationId, ListenAddress, Port, new BinaryMessageSerializer(), new UnencryptedCryptoProviderResolver());
            dispatcher         = new OperationDispatcher();
            IPEndPoint senderEndPoint = null;
            IPEndPoint clientEndPoint = null;

            dispatcher.RegisterHandler <IEndPointProvisioner>(new EndPointProvisioner {
                OnStuff = e => senderEndPoint = e
            });
            server = new GenericServerEndpoint(connectionListener, new ServerConfig(), () => dispatcher);
            server.Start();

            using (ClientConnection client = CreateClientConnection())
            {
                client.Open();
                clientEndPoint = client.GetClientEndpoint();
                client.RemoteExecutor.Create <IEndPointProvisioner>().DoStuff(null);
            }
            server.Dispose();
            Assert.AreEqual(clientEndPoint, senderEndPoint);
        }
Beispiel #3
0
 public void TearDown()
 {
     _server.Dispose();
 }