Exemplo n.º 1
0
        public ISocket CreateSocket()
        {
            var socket = new StubSocket();
            sockets.Add(socket);

            return socket;
        }
 private void Wait(StubSocket socket)
 {
     if (socket == null)
     {
         Thread.Sleep(socketWaitTimeout);
     }
 }
        public ISocket CreateSocket()
        {
            var socket = new StubSocket();
            sockets.Add(new SocketMeta
                        {
                            Socket = socket,
                            Purpose = GetSocketPurpose()
                        }
                );

            return socket;
        }
Exemplo n.º 4
0
        public ISocket CreateSocket()
        {
            var socket = new StubSocket();
            sockets.Add(new SocketMeta
                        {
                            Socket = socket,
                            IsRegistrationSocket = IsRegistrationSocket()
                        }
                );

            return socket;
        }
Exemplo n.º 5
0
        private static IMessage SendMessageOverMessageHub()
        {
            var messageTracer = new Mock<kino.Client.IMessageTracer>();
            var logger = new Mock<ILogger>();
            var sockrtFactory = new Mock<ISocketFactory>();
            var socket = new StubSocket();
            sockrtFactory.Setup(m => m.CreateDealerSocket()).Returns(socket);

            var message = Message.CreateFlowStartMessage(new SimpleMessage(), SimpleMessage.MessageIdentity);
            var callback = new CallbackPoint(SimpleMessage.MessageIdentity);

            var messageHub = new MessageHub(sockrtFactory.Object,
                                            new CallbackHandlerStack(new ExpirableItemCollection<CorrelationId>(logger.Object)),
                                            new MessageHubConfiguration(),
                                            messageTracer.Object,
                                            logger.Object);
            messageHub.Start();
            messageHub.EnqueueRequest(message, callback);
            Thread.Sleep(AsyncOpCompletionDelay);

            return socket.GetSentMessages().BlockingLast(AsyncOpCompletionDelay);
        }