public void Setup() { callbackHandlerStack = new Mock<ICallbackHandlerStack>(); loggerMock = new Mock<ILogger>(); logger = new Logger("default"); messageHubSocketFactory = new MessageHubSocketFactory(); socketFactory = new Mock<ISocketFactory>(); socketFactory.Setup(m => m.CreateDealerSocket()).Returns(messageHubSocketFactory.CreateSocket); config = new MessageHubConfiguration { RouterUri = new Uri(localhost) }; messageTracer = new Mock<IMessageTracer>(); }
public MessageHub(ISocketFactory socketFactory, ICallbackHandlerStack callbackHandlers, MessageHubConfiguration config, IMessageTracer messageTracer, ILogger logger) { this.logger = logger; this.messageTracer = messageTracer; this.socketFactory = socketFactory; this.config = config; receivingSocketIdentityPromise = new TaskCompletionSource<byte[]>(); hubRegistered = new ManualResetEventSlim(); this.callbackHandlers = callbackHandlers; registrationsQueue = new BlockingCollection<CallbackRegistration>(new ConcurrentQueue<CallbackRegistration>()); cancellationTokenSource = new CancellationTokenSource(); }