Ignore node network errors after opening client socket #220
This is another stab at fixing High Sierra tests for nes.
Since ws 3.3.3, node net.Socket errors are reemitted by ws. We aren't really interested in these events, since they are not emitted by browser implementations of websockets. What we're interested in in those cases is the close event which will be emitted by both browser and ws.
In our tests we close both server and websocket at the same time, meaning the server could close the TCP socket at the same time the client sends a close frame, which causes a ECONNRESET socket error. For some reason (timing difference?) this manifests in Mac OS X High Sierra by logging or throwing an error for each test. In some cases it just causes console noise. in other cases where no onerror is defined it will throw and cause the test to fail.
I brought this up on ws: websockets/ws#1316
The advice is to ignore net.Socket errors once the websocket is open, and in fact these won't even be emitted by ws in future versions. Doing so in nes and attaching onerror handlers for where we use raw ws in the tests fixes all the test issues AFAIK.