Fix socket tests on windows

Confirmed by @magistere to fix the socket tests on Windows.

Closes #4151