public function testChannelModel_IsAwareOfItsOwnConnection($data)
{
$this->simulate(function (SimulationInterface $sim) use($data) {
$loop = $sim->getLoop();
$master = $this->createModel($data['master'], $loop);
$master->on('start', function () use($sim, $master) {
if (!$master->isStarted()) {
$sim->fail('Master should be marked as connected.');
}
$master->stop();
});
$master->on('stop', function () use($sim, $master) {
if (!$master->isStopped()) {
$sim->fail('Master should be marked as disconnected.');
}
$sim->done();
});
$sim->onStart(function () use($master) {
$master->start();
});
});
}