[testing] Replace ConnectionRefusedError by socket.error

It is less precise, but ConnectionRefusedError is something new in 3.3