public void send_message() { var message = "Hello World!"; var listener = new HttpListenerAcceptor(new IPEndPoint(IPAddress.Any, 8080), new Uri("/", UriKind.Relative), new MessageRequestHandler(message)); try { listener.Start(); var request = WebRequest.Create("http://localhost:8080/"); var response = request.GetResponse(); Verify.That(() => response.ContentLength == message.Length); using(var reader = new StreamReader(response.GetResponseStream())) Verify.That(() => reader.ReadToEnd() == message); } finally { listener.Stop(); } }
public HttpListenerAcceptorContext(HttpListenerAcceptor listener, int offset) { Listener = listener; Offset = offset; }
public void with_absolute_path() { var listener = new HttpListenerAcceptor(new IPEndPoint(IPAddress.Any, 80), new Uri("http://example.com"), new NullHttpListenerRequestHandler()); Verify.That(() => listener.Prefix == "http://example.com:80/"); }
public void with_relative_path() { var listener = new HttpListenerAcceptor(new IPEndPoint(IPAddress.Any, 80), new Uri("/Foo", UriKind.Relative), new NullHttpListenerRequestHandler()); Verify.That(() => listener.Prefix == "http://*:80/Foo/"); }
MvcHost(HttpListenerAcceptor acceptor, IConcoctApplication application) { this.acceptor = acceptor; this.application = application; }