/**
  *
  */
 public function testHandleRequestWithAuthentication()
 {
     // Test that authentication handlers are called properly
     /* @var \PHPUnit_Framework_MockObject_MockObject|HandlerInterface $authenticationHandler */
     $authenticationHandler = $this->getMockBuilder(HandlerInterface::class)->setMethods(['handle', 'requireAuthentication'])->getMock();
     $authenticationHandler->expects($this->once())->method('handle')->willReturn(false);
     $authenticationHandler->expects($this->once())->method('requireAuthentication');
     $this->staticWebServer->setAuthenticationHandler($authenticationHandler);
     $this->staticWebServer->handleRequest(new Request('GET', '/'), new Response($this->getMockedConnection()));
 }
 /**
  * @inheritdoc
  */
 public function __construct(Configuration $configuration, LoggerInterface $logger, EventDispatcher $eventDispatcher, LoopInterface $loop)
 {
     parent::__construct($configuration, $logger, $eventDispatcher);
     $socket = new SocketServer($loop);
     $socket->listen($configuration->getHttpListenPort(), $configuration->getListenAddress());
     // Configure the web server
     $webroot = realpath(__DIR__ . '/../../client/app');
     $this->_staticWebServer = new StaticWebServer(new HttpServer($socket), $webroot, $logger);
     // Configure the authentication handler
     $this->_staticWebServer->setAuthenticationHandler(new BasicAuthenticationHandler('tvheadend-status-manager', [$this, 'validateCredentials']));
 }