public function testApiHandleConnect_ClosesConnection_WhenComponentThrowsException()
{
$listener = $this->createListener();
$component = $this->createComponent();
$component->expects($this->once())->method('handleConnect')->with($this->isInstanceOf(NetworkConnection::class))->will($this->throwException(new Exception()));
$socket = $this->getMock(SocketInterface::class, [], [], '', false);
$server = $this->createSocketServer($listener, $component, ['close']);
$server->expects($this->once())->method('close')->with($socket);
$server->handleConnect($listener, $socket);
}