public override bool ExecuteStep() { try { this.mockHost = new MessagingHost(this.ServiceURI); this.AppendResultDescription(0, "Starting 1-Way mock service. Base Address : {0}", this.ServiceURI); this.mockHost.Listen(); this.AppendResultDescription(0, "Mock service started successfully"); this.Result = StepResult.Working; } catch (Exception exc) { this.AppendResultDescription(0, "Failed to start mock service with address {0} : {1}", this.ServiceURI, exc.Message); this.Result = StepResult.Error; } return(this.Result == StepResult.Working); }
static void Main(string[] args) { MessagingHost server = new MessagingHost(); server.Connection.ConnectionStatusChanged += WriteState; server.MessageReceived += Write; server.ConnectionClosed += WriteDisconnect; server.Start(); string input = ""; while (input != "q") { input = Console.ReadLine(); server.Send(input); } server.Stop(); Console.ReadKey(); }
static void Main(string[] args) { MessagingHost server = new MessagingHost(); server.Connection.ConnectionStatusChanged += WriteState; server.MessageReceived += Write; server.ConnectionClosed += WriteDisconnect; var remoteEP = new IPEndPoint(IPAddress.Parse("192.168.1.69"), 25566); server.Connect(remoteEP); mre.WaitOne(); string input = ""; while (input != "q") { input = Console.ReadLine(); server.Send(input); } server.Stop(); Console.ReadKey(); }