Fix port collision detection in functional tests
Summary: If a port is bound but not listening, cannot bind to it anymore but the test will see the port as closed and let us use that, causing a failure. This diff fixes this potential issue by trying to bind instead of connecting.
Test Plan:
ninja check-functional
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Subscribers: PiRK
Differential Revision: https://reviews.bitcoinabc.org/D13433