Ejemplo n.º 1
0
 public void Unbind(Uri address)
     => socket.Unbind(address.ToSocketAddress());
Ejemplo n.º 2
0
 public void Bind(Uri address)
     => socket.Bind(address.ToSocketAddress());
Ejemplo n.º 3
0
 public void Connect(Uri address)
     => socket.Connect(address.ToSocketAddress());
Ejemplo n.º 4
0
 public void Disconnect(Uri address)
     => socket.Disconnect(address.ToSocketAddress());
Ejemplo n.º 5
0
        public void TestIfUnregisterNodeMessageRouteMessage_AllRoutesAreRemovedFromExternalRoutingTable()
        {
            var externalRoutingTable = new ExternalRoutingTable(logger);
            var router = new MessageRouter(socketFactory.Object,
                                           new InternalRoutingTable(),
                                           externalRoutingTable,
                                           routerConfiguration,
                                           clusterMonitor.Object,
                                           messageTracer.Object,
                                           logger);
            try
            {
                StartMessageRouter(router);

                var messageIdentifiers = new[]
                                         {
                                             new MessageIdentifier(Message.CurrentVersion, SimpleMessage.MessageIdentity),
                                             new MessageIdentifier(Message.CurrentVersion, AsyncMessage.MessageIdentity)
                                         };

                var socketIdentity = SocketIdentifier.Create();
                var uri = new Uri("tcp://127.0.0.1:8000");
                messageIdentifiers.ForEach(mi => externalRoutingTable.AddMessageRoute(mi, socketIdentity, uri));
                var message = Message.Create(new UnregisterNodeMessageRouteMessage
                {
                                                 Uri = uri.ToSocketAddress(),
                                                 SocketIdentity = socketIdentity.Identity
                                             },
                                             UnregisterNodeMessageRouteMessage.MessageIdentity);

                CollectionAssert.IsNotEmpty(externalRoutingTable.GetAllRoutes());
                messageRouterSocketFactory.GetRouterSocket().DeliverMessage(message);

                Thread.Sleep(AsyncOp);

                CollectionAssert.IsEmpty(externalRoutingTable.GetAllRoutes());
            }
            finally
            {
                router.Stop();
            }
        }