Created
January 9, 2011 07:16
-
-
Save assaf/771508 to your computer and use it in GitHub Desktop.
Simple test case for the Zombie protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
z = require("./src/index") | |
z.listen null, (err)-> | |
console.log "Listening" | |
console.log err if err | |
requests =[ | |
"*1\r\n$7\r\nBROWSER", | |
"*3\r\n$5\r\nVISIT$1\r\n0$20\r\nhttp://labnotes.org/", | |
"*2\r\n$4\r\nWAIT$1\r\n0" | |
] | |
stream = require("net").createConnection(8091, "localhost") | |
stream.on "data", (data)-> | |
console.log "Response:", data.toString().trim() | |
if request = requests.shift() | |
stream.write request | |
else | |
stream.end() | |
stream.setNoDelay true | |
stream.write requests.shift() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment