test: refactor flaky net-error-twice
The test was not reliably creating the error event on Windows 2012.
This makes the test more robust by delaying the destruction of the socket until after data starts arriving rather than immediately upon connection.