test: fix flaky test-net-socket-local-address
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic.
Refs: #4476 and #4644 R= @trott