node.js hanging tcp connecting attempt

When massive tcp connecting attempts from node.js javascript client to server while server is restarting, some connecting attempts are hanging. I wrote a simple script to reproduce it:

var net = require('net');

function Conn() {
    var conn = new net.Socket({allowHalfOpen: false});
    conn.setTimeout(1000);
    conn.on('error', function (connectionException) {
        console.log('TCP Repeater error: ' + connectionException);
        this.connected = false;
    });
    conn.on('connect', function () {
        console.log("connected");
        this.connected = true;
    });
    conn.on('close', function () {
        console.log("connection closed");
        this.connected = false;
    });
    conn.on('timeout', function () {
        console.log("connection timeout");
        this.connected = false;
    });
    conn.connect(9997, "localhost");
}

for (var i=0;i<400;i++) {
    new Conn();
}

Run this script against a starting tcp server. Some attempts are getting errors as server has been started, some attempts are connected after server is started. However, some attempts won't trigger any events and just hanging.

Is there anyway I can kill those hanging attempts? It looks connection timeout won't help as it's for inactivity of established connections. Is there any way to set connecting timeout like setSoTimeout in java?

Thanks