This fixes a non-deterministic failure in the tests.
Also fix another less-common failure in test.util.refusing_port.
if self.timeout is not None:
# If the first attempt failed, don't wait for the
# timeout to try an address from the secondary queue.
+ self.io_loop.remove_timeout(self.timeout)
self.on_timeout()
return
self.clear_timeout()
# ephemeral port number to ensure that nothing can listen on that
# port.
server_socket, port = bind_unused_port()
+ server_socket.setblocking(1)
client_socket = socket.socket()
client_socket.connect(("127.0.0.1", port))
conn, client_addr = server_socket.accept()