ECONNREFUSED usually means that the process that you are trying to connect to is actually not running. Perhaps you started the server and didn't wait long enough for it to start running? Or maybe the server was unable to listen on the port you are connecting to because that port was already in use (likely by a previous instance of that same server).
–
David SchwartzDec 27 '12 at 10:34

Does the test create a new instance of the server? Or do both tests use the same instance of the server that remains running throughout them?
–
David SchwartzDec 27 '12 at 10:35

Each test creates a new instance of the server, binds it to port 3000 and closes the server before finishing. This works in a perfect way (there is even a test for that ;-)). Regarding the issue of not waiting long enough: I'm using a callback that is called by the listen function, hence the server should be up and running.
–
Golo RodenDec 27 '12 at 10:40

You confirmed that bind/listen succeed in the server?
–
David SchwartzDec 27 '12 at 10:42

1

That is one task for which I am fully qualified. :)
–
David SchwartzDec 27 '12 at 10:56