public function testApiHandleMessage_HandlesError_WhenHttpRequestReceived_ButHandleConnectThrowsException()
{
$conn = $this->getMock(NetworkConnection::class, [], [], '', false);
$mssg = $this->createPassableMessage();
$server = $this->createServer();
$router = $this->createRouter($server);
$component = $this->createComponent();
$component->expects($this->once())->method('handleConnect')->will($this->throwException($ex = new Exception()));
$component->expects($this->once())->method('handleError')->with($conn, $ex);
$matcher = $this->createMatcher(['match']);
$matcher->expects($this->once())->method('match')->will($this->returnValue(['_controller' => $component]));
$router->handleMessage($conn, $mssg);
}