public void can_accept_http_posts() { var server = new LocalHttpListener(); Task.Factory.StartNew(server.Start); WebRequest webRequest = CreateWebRequest(); using (var webResponse = (HttpWebResponse) webRequest.GetResponse()) { WebResponseInfo info = LocalHttpListener.Read(webResponse); Console.WriteLine("Client received: " + info); } server.Stop(); }
private void button1_Click(object sender, EventArgs e) { var server = new LocalHttpListener(); var task = Task.Factory.StartNew(() => server.Start()); button1.Enabled = false; }