Test case for #304.

Currently fails because `error` event fires twice: first with `ETIMEDOUT` and then with `ECONNRESET`.