public MessagePublisher(string address, IMessageSerializer serializer, string topic, SocketType socketType = SocketType.Server) { _address = address; _serializer = serializer; _topic = topic; _socketType = socketType; _socket = new Lazy <PublisherSocket>(() => { var socket = new PublisherSocket(); socket.Start(_address, _socketType); Thread.Sleep(TimeSpan.FromSeconds(1)); // wait for subscribers return(socket); }); }