Conditional include of socket.h or winsock2 in tests (closes #169)

Thanks to MarjanTomas.