Skip to content

Instantly share code, notes, and snippets.

@mnutt
Created November 4, 2011 19:23
Show Gist options
  • Save mnutt/1340246 to your computer and use it in GitHub Desktop.
Save mnutt/1340246 to your computer and use it in GitHub Desktop.
var http = require('http');
// Unresponsive server
http.createServer(function(req, res) {
// don't respond
}).listen(5933);
// Client that times out
var client = http.createClient(5933, '127.0.0.1');
client.on('error', function(e) { console.log("ERROR"); });
client.on('timeout', function(e) { console.log("TIMEOUT"); });
client.setTimeout(1000);
var preq = client.request("GET", "/", {});
preq.on('response', function(pres) { console.log("RESPONSE"); });
preq.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment