Chances are you are struggling with the node.js dying whenever the server you are calling refuses to connect. Try this:
process.on('uncaughtException', function (err) {
console.log(err);
});
This keeps your server running and also give you a place to attach the debugger and look for a deeper problem.