|
|
@ -26,11 +26,13 @@ var srv = net.createServer(function(c) { |
|
|
|
c.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
srv.listen(common.PORT, '127.0.0.1'); |
|
|
|
|
|
|
|
var gotUpgrade = false; |
|
|
|
var hc = http.createClient(common.PORT, '127.0.0.1'); |
|
|
|
hc.addListener('upgrade', function(res, socket, upgradeHead) { |
|
|
|
|
|
|
|
srv.listen(common.PORT, '127.0.0.1', function () { |
|
|
|
|
|
|
|
var hc = http.createClient(common.PORT, '127.0.0.1'); |
|
|
|
hc.addListener('upgrade', function(res, socket, upgradeHead) { |
|
|
|
// XXX: This test isn't fantastic, as it assumes that the entire response
|
|
|
|
// from the server will arrive in a single data callback
|
|
|
|
assert.equal(upgradeHead, 'nurtzo'); |
|
|
@ -46,8 +48,9 @@ hc.addListener('upgrade', function(res, socket, upgradeHead) { |
|
|
|
srv.close(); |
|
|
|
|
|
|
|
gotUpgrade = true; |
|
|
|
}); |
|
|
|
hc.request('GET', '/').end(); |
|
|
|
}); |
|
|
|
hc.request('GET', '/').end(); |
|
|
|
|
|
|
|
process.addListener('exit', function() { |
|
|
|
assert.ok(gotUpgrade); |
|
|
|