Run listener with a large time offset and ensure it's not connected

This commit is contained in:
Lee Miller 2023-09-04 04:58:02 +03:00
parent 110dfc3324
commit ba95d046f9
Signed by: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -198,6 +198,19 @@ class TestListener(TestProcessProto):
self.assertFalse(listener.is_alive()) self.assertFalse(listener.is_alive())
def test_listener_timeoffset(self):
"""Run listener with a large time offset - shouldn't connect"""
with time_offset(4000):
with run_listener() as listener:
if not listener:
self.fail('Failed to start listener')
shared.connection_limit = 2
for _ in range(30):
for c in shared.connections:
if c.status == 'fully_established':
self.fail('Established a connection')
time.sleep(0.5)
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
super().tearDownClass() super().tearDownClass()