|
|
@ -12,11 +12,13 @@ server.on('upgrade', function(req, socket, head) { |
|
|
|
socket.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
server.listen(8000); |
|
|
|
|
|
|
|
var client = http.createClient(8000); |
|
|
|
|
|
|
|
function upgradeRequest(fn) { |
|
|
|
server.listen(common.PORT, function () { |
|
|
|
|
|
|
|
var client = http.createClient(common.PORT); |
|
|
|
|
|
|
|
function upgradeRequest(fn) { |
|
|
|
var request = client.request('GET', '/', { |
|
|
|
'Connection': 'Upgrade', |
|
|
|
'Upgrade': 'Test' |
|
|
@ -44,10 +46,10 @@ function upgradeRequest(fn) { |
|
|
|
|
|
|
|
request.write('head'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
successCount = 0; |
|
|
|
upgradeRequest(function() { |
|
|
|
successCount = 0; |
|
|
|
upgradeRequest(function() { |
|
|
|
successCount++; |
|
|
|
upgradeRequest(function() { |
|
|
|
successCount++; |
|
|
@ -57,6 +59,8 @@ upgradeRequest(function() { |
|
|
|
client.destroy(); |
|
|
|
server.close(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
process.on('exit', function () { |
|
|
|