Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created November 25, 2010 18:52
Show Gist options
  • Save isaacs/715781 to your computer and use it in GitHub Desktop.
Save isaacs/715781 to your computer and use it in GitHub Desktop.
var http = require("http")
http.createServer(function (req, res) {
// let it time out
// just hold the connection open forever
}).listen(8080)
var r = http.createClient(8080, "localhost").request("GET", "/", {})
r.on("response", function (res) {
console.log("got response")
})
r.connection.setTimeout(100)
r.connection.on("timeout", function () {
console.log("timeout!")
})
r.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment