public function enableSsl() { $this->share('handler.https', function () { $handler = new SslHttpHandler($this['handler.options']); $handler->setLogger($this->get('logger')); foreach ($this->getTaggedServices('processor') as $processor) { $handler->addProcessor($processor); } return $handler; }); $this->share('server.https', function () { $server = new SslHttpServer($this->get('handler.https')); return $server->listen($this['address.https']); }, ['server']); }
public function testSocket() { $path = $this->getCachePath('localhost:8443'); if (file_exists($path)) { unlink($path); } $server = new SslHttpServer(new SslHttpHandler()); $socket = $server->createSocket('localhost:8443'); $this->assertInternalType('resource', $socket); fclose($socket); $server = new SslHttpServer(new SslHttpHandler()); $socket = $server->createSocket('localhost:8443'); $this->assertInternalType('resource', $socket); fclose($socket); if (file_exists($path)) { unlink($path); } }