Fix the listen() invocation for the test server not to pass a backlog
value of zero. The value of zero means no backlog which effectively
means that the socket can not accept any connections. This does not
matter for the majority of platforms since the value is only advisory
and the platform tends to go with a bigger backlog anyway. However,
a few platforms (e.g. alpha or riscv Linux) do take the value literally,
and therefore the tests fail since they are unable to connect to
the server.
So that failing tests don't cause the server thread to hang
indefinitely, waiting for connections that will never come.
Rationale for suppressing error/traceback from interrupted
_accept_connection in testserver.Server:
https://gist.github.com/brettdh/b6e741227b2297f19d2118077f14dfa5
* Move server socket close to just before join
This way it handles the no-connections, no-exceptions case
as well as the exception case. If the server thread doesn't
exit by itself within 5 seconds of the context manager exit,
the accept will be interrupted.
* Address feedback
- pytest.raises rather than except:pass
- Move socket create/bind back to run()
- Timeout on accepting connections
It seems it's necessary both in pulling all_proxy from the environment
(rebuild_proxies) and deciding which proxy to use (select_proxy).
Also added new functional test.