Guest User

Untitled

a guest
Jul 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. var http = require("http")
  2.  
  3. http.createServer(function (req, res) {
  4. // let it time out
  5. // just hold the connection open forever
  6. }).listen(8080)
  7.  
  8. var r = http.createClient(8080, "localhost").request("GET", "/", {})
  9. r.on("response", function (res) {
  10. console.log("got response")
  11. })
  12. r.connection.setTimeout(100)
  13. r.connection.on("timeout", function () {
  14. console.log("timeout!")
  15. })
  16. r.end()
Add Comment
Please, Sign In to add comment