public function __construct(RequestHandler $handler, Log $log = null, Driver $driver = null, ServerFactory $factory = null) { $this->handler = $handler; $this->log = $log ?: log(); $this->driver = $driver ?: new Http1Driver(); $this->factory = $factory ?: new DefaultServerFactory(); $this->onError = function (Throwable $exception) { $this->close(); throw $exception; }; }