public function testChannelModel_AllowsReconnections_InThreesome($data)
{
$this->simulate(function (SimulationInterface $sim) use($data) {
$loop = $sim->getLoop();
$data['master']['config']['heartbeatKeepalive'] = 100;
$master = $this->createModel($data['master'], $loop);
$slave1 = $this->createModel($data['slave1'], $loop);
$master->times('connect', 2, function ($name) use($sim, $slave1) {
$sim->expect('connect', [$name]);
$slave1->stop();
});
$slave1->once('stop', function () use($sim, $slave1, $loop) {
$loop->addTimer(0.25, function () use($slave1) {
$slave1->start();
});
});
$slave1->delayOnce('stop', 2, function () use($sim) {
$sim->done();
});
$sim->onStart(function () use($master, $slave1) {
$master->start();
$slave1->start();
});
$sim->onStop(function () use($master, $slave1) {
$master->stop();
$slave1->stop();
});
})->expect([['connect', [self::ALIAS_B]], ['connect', [self::ALIAS_B]]]);
}