diff options
author | arlolra <arlolra@gmail.com> | 2010-02-25 01:36:17 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-02-25 11:41:11 -0800 |
commit | 04fac198225ae48ed7726c15609d254fddce4862 (patch) | |
tree | b09866cfed0c40d4cd3731f1d8b161e335df17e0 /test/pummel/test-http-client-reconnect-bug.js | |
parent | 9ad7539cf9c36edf4b014adb1ce979f578de0aa1 (diff) | |
download | node-new-04fac198225ae48ed7726c15609d254fddce4862.tar.gz |
Split tests.
Diffstat (limited to 'test/pummel/test-http-client-reconnect-bug.js')
-rw-r--r-- | test/pummel/test-http-client-reconnect-bug.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js new file mode 100644 index 0000000000..0440a52a1f --- /dev/null +++ b/test/pummel/test-http-client-reconnect-bug.js @@ -0,0 +1,43 @@ +process.mixin(require("../common")); + +var tcp = require("tcp"), + sys = require("sys"), + http = require("http"); + +var PORT = 2143; + +var errorCount = 0; +var eofCount = 0; + +var server = tcp.createServer(function(socket) { + socket.close(); +}); +server.listen(PORT); + +var client = http.createClient(PORT); + +client.addListener("error", function() { + sys.puts("ERROR!"); + errorCount++; +}); + +client.addListener("end", function() { + sys.puts("EOF!"); + eofCount++; +}); + +var request = client.request("GET", "/", {"host": "localhost"}); +request.addListener('response', function(response) { + sys.puts("STATUS: " + response.statusCode); +}); +request.close(); + +setTimeout(function () { + server.close(); +}, 500); + + +process.addListener('exit', function () { + assert.equal(0, errorCount); + assert.equal(1, eofCount); +}); |