tests: Fix error on MacOS for udp_dtls_handshake test

pull/3612/head
Bartek Szatkowski 2017-01-19 13:13:18 +00:00
parent 04a31f3b39
commit 537f4db0af
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,10 @@ class UDPEchoClientTest(BaseHostTest):
:return:
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((target_ip, 0)) # Target IP, Any port
try:
s.connect((target_ip, 0)) # Target IP, any port
except socket.error:
s.connect((target_ip, 8000)) # Target IP, 'random' port
ip = s.getsockname()[0]
s.close()
return ip