public function testApiHandleData_TriesToHandleError_WhenComponentThrowsException()
{
$data = 'data';
$listener = $this->createListener();
$component = $this->createComponent();
$component->expects($this->once())->method('handleMessage')->with($this->isInstanceOf(NetworkConnection::class), $this->isInstanceOf(NetworkMessage::class))->will($this->throwException($ex = new Exception()));
$socket = $this->getMock(SocketInterface::class, [], [], '', false);
$socket->conn = new NetworkConnection($socket);
$server = $this->createSocketServer($listener, $component, ['handleError']);
$server->expects($this->once())->method('handleError')->with($socket, $ex);
$server->handleData($socket, $data);
}