private ZmqTransport CreateAndStartZmqTransport(string endPoint = null, Action <TransportMessage> onMessageReceived = null, string peerId = null, string environment = _environment) { var configurationMock = new Mock <IZmqTransportConfiguration>(); configurationMock.SetupGet(x => x.InboundEndPoint).Returns(endPoint); configurationMock.SetupGet(x => x.WaitForEndOfStreamAckTimeout).Returns(1.Second()); if (peerId == null) { peerId = $"Abc.Testing.{Guid.NewGuid():N}"; } var transport = new ZmqTransport(configurationMock.Object, new ZmqSocketOptions(), new DefaultZmqOutboundSocketErrorHandler()); transport.SetLogId(_transports.Count); transport.SocketOptions.SendTimeout = 500.Milliseconds(); _transports.Add(transport); transport.Configure(new PeerId(peerId), environment); if (onMessageReceived != null) { transport.MessageReceived += onMessageReceived; } transport.Start(); return(transport); }
private ZmqTransport CreateAndStartZmqTransport(string peerId, Action<TransportMessage> onMessageReceived = null) { var configurationMock = new Mock<IZmqTransportConfiguration>(); var transport = new ZmqTransport(configurationMock.Object, new ZmqSocketOptions()); transport.Configure(new PeerId(peerId), "test"); transport.SocketOptions.SendTimeout = 5.Seconds(); if (onMessageReceived != null) transport.MessageReceived += onMessageReceived; transport.Start(); return transport; }
private ZmqTransport CreateAndStartZmqTransport(string peerId, Action <TransportMessage> onMessageReceived = null) { var configurationMock = new Mock <IZmqTransportConfiguration>(); var transport = new ZmqTransport(configurationMock.Object, new ZmqSocketOptions(), new DefaultZmqOutboundSocketErrorHandler()); transport.Configure(new PeerId(peerId), "test"); transport.SocketOptions.SendTimeout = 5.Seconds(); if (onMessageReceived != null) { transport.MessageReceived += onMessageReceived; } transport.Start(); return(transport); }