Skip to content

Instantly share code, notes, and snippets.

@Kami
Created November 18, 2010 17:04
Show Gist options
  • Select an option

  • Save Kami/705283 to your computer and use it in GitHub Desktop.

Select an option

Save Kami/705283 to your computer and use it in GitHub Desktop.
var http = require('http');
var assert = require('assert');
var http_server = http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text-plain'});
response.end('');
}).listen(8081, '127.0.0.1', done);
function done() {
var client = http.createClient(8081, 'localhost', true);
var request = client.request('GET', '/', {});
request.end();
client.on('end', function() {
// This will fail and if the request.connection.destroy() isn't called manualy,
// the socket will hang in the CLOSE_WAIT state
assert.ok(request.socket._writeQueue.length == 0);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment