diff --git a/src/tribler/test_integration/test_anon_download.py b/src/tribler/test_integration/test_anon_download.py
index 131d48bb3d..98c5707e1b 100644
--- a/src/tribler/test_integration/test_anon_download.py
+++ b/src/tribler/test_integration/test_anon_download.py
@@ -194,6 +194,10 @@ async def start_anon_download(self, infohash: bytes) -> Download:
 
         download = await self.download_manager_downloader.start_download(tdef=TorrentDefNoMetainfo(infohash, b"test"),
                                                                          config=config)
+
+        while not self.download_manager_seeder.listen_ports[0]:
+            await sleep(0.1)
+
         self.overlay(DOWNLOADER).bittorrent_peers[download] = {
             ("127.0.0.1", self.download_manager_seeder.listen_ports[0]["127.0.0.1"])
         }