protected override void OnShown(EventArgs e) { var workerFactory = new WorkerManager( new BufferManager(10, 2048), TimeSpan.FromTicks(1), _logger); var listener = new Listener( new ListenerSettings(IPAddress.Any, 8088), s => workerFactory.Get(new WorkerSocket(s)) ); var process = new ServerProcess( listener, () => new HttpMessageHandler(_logger), _logger) { Name = "sandbox", Server = _server }; process.Start(); StartStopButton.Click += (s, ce) => { if (process.IsStarted) { process.Stop(); StartStopButton.Text = "Start"; } else { process.Start(); StartStopButton.Text = "Stop"; } }; }
protected listener_test_base( TestSettings settings = null) { Settings = settings ?? new TestSettings(); var ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); _ipAddress = ipHostInfo.AddressList[1]; _manager = new BufferManager(Settings.MaxConnections, Settings.BufferSize); var workerFactory = new WorkerManager(_manager, Settings.Timeout, null); _listener = new Listener( new ListenerSettings(_ipAddress, ++_port), s => workerFactory.Get(new WorkerSocket(s))); _listener.Start(); }