async def METHOD_NAME(self, time_travel):
    """Test reconnect handling."""
    xknx = XKNX()
    xknx.task_registry.start()
    assert len(xknx.connection_manager._connection_state_changed_cbs) == 1
    await xknx.connection_manager.connection_state_changed(
        XknxConnectionState.CONNECTED
    )
    # pylint: disable=attribute-defined-outside-init
    self.test = 0
    async def callback() -> None:
        """Reset tasks."""
        try:
            while True:
                await asyncio.sleep(100)
                self.test += 1
        except asyncio.CancelledError:
            self.test -= 1
    task = xknx.task_registry.register(
        name="test", async_func=callback, restart_after_reconnect=True
    )
    assert len(xknx.task_registry.tasks) == 1
    task.start()
    assert task._task is not None
    await time_travel(100)
    assert self.test == 1
    await xknx.connection_manager.connection_state_changed(
        XknxConnectionState.DISCONNECTED
    )
    assert task._task is None
    assert self.test == 0
    await xknx.connection_manager.connection_state_changed(
        XknxConnectionState.CONNECTED
    )
    assert task._task is not None
    assert self.test == 0
    await time_travel(100)
    assert self.test == 1
    assert len(xknx.task_registry.tasks) == 1
    xknx.task_registry.stop()
    assert len(xknx.task_registry.tasks) == 0
    assert task._task is None
    await asyncio.sleep(0)  # iterate loop to cancel task
    assert self.test == 0
    assert len(xknx.connection_manager._connection_state_changed_cbs) == 0