private static void Test_HttpServer() { using (var server = new HttpListenerServer()) { server.TcpPort = 23979; server.Start(); while (server.IsRunning) { } } }
public void Init() { mailResponder = new MailResponder(); server = new HttpListenerServer(new string[] { URL }, mailResponder); server.Start(); HttpWebRequest requestTemplate = (HttpWebRequest)HttpWebRequest.Create(URL); requestTemplate.Timeout = 6000; requestTemplate.Proxy = null; transceiver = new HttpTransceiver(requestTemplate); proxy = new GenericRequestor(transceiver, MailResponder.Protocol); }
//[TestInitialize] public void Init() { mailResponder = new MailResponder(); server = new HttpListenerServer(new string[] { URL }, mailResponder); server.Start(); HttpWebRequest requestTemplate = (HttpWebRequest)HttpWebRequest.Create(URL); requestTemplate.Timeout = 6000; requestTemplate.Proxy = null; transceiver = new HttpTransceiver(requestTemplate); proxy = new GenericRequestor(transceiver, MailResponder.Protocol); }
static void Main(string[] args) { bool running = false; JObject config = LoadConfig(); if (config != null) { MapHandler fileHandler = ConfigureFileHandler(config); List <MapHandler> handlers = new List <MapHandler>(); if (fileHandler != null) { handlers.Add(fileHandler); } HttpListenerServer server = ConfigureWebServer(config, handlers); if (server != null) { running = true; server.Start(); Console.WriteLine("Listening, enter to stop"); Console.ReadLine(); server.Stop(); Console.WriteLine("Stopped"); server.Dispose(); } } if (!running) //we failed along the way { Console.WriteLine("Failed to configure and startup"); } Console.WriteLine("Enter to exit"); Console.ReadLine(); }
private void StartServer() { _httpListenerServer.Start(); _httpListenerServer.RegisterRequestHandler(_requestHandlerMock.HandleRequest); }