|
@ -26,10 +26,8 @@ if (!process.versions.openssl) { |
|
|
|
|
|
|
|
|
var common = require('../common'); |
|
|
var common = require('../common'); |
|
|
var assert = require('assert'); |
|
|
var assert = require('assert'); |
|
|
|
|
|
|
|
|
var fs = require('fs'); |
|
|
var fs = require('fs'); |
|
|
var exec = require('child_process').exec; |
|
|
var exec = require('child_process').exec; |
|
|
|
|
|
|
|
|
var https = require('https'); |
|
|
var https = require('https'); |
|
|
|
|
|
|
|
|
var options = { |
|
|
var options = { |
|
@ -40,36 +38,36 @@ var options = { |
|
|
// a server that never replies
|
|
|
// a server that never replies
|
|
|
var server = https.createServer(options, function() { |
|
|
var server = https.createServer(options, function() { |
|
|
console.log('Got request. Doing nothing.'); |
|
|
console.log('Got request. Doing nothing.'); |
|
|
}).listen(common.PORT); |
|
|
}).listen(common.PORT, function() { |
|
|
|
|
|
var req = https.request({ |
|
|
var req = https.request({ |
|
|
host: 'localhost', |
|
|
host: 'localhost', |
|
|
port: common.PORT, |
|
|
port: common.PORT, |
|
|
path: '/', |
|
|
path: '/', |
|
|
method: 'GET' |
|
|
method: 'GET' |
|
|
}); |
|
|
}); |
|
|
req.setTimeout(10); |
|
|
req.end(); |
|
|
req.end(); |
|
|
req.on('response', function(res) { |
|
|
|
|
|
console.log('got response'); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
req.on('socket', function() { |
|
|
|
|
|
console.log('got a socket'); |
|
|
|
|
|
|
|
|
|
|
|
req.socket.on('connect', function() { |
|
|
req.on('response', function(res) { |
|
|
console.log('socket connected'); |
|
|
console.log('got response'); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
req.on('socket', function() { |
|
|
throw new Error('Did not get timeout event'); |
|
|
console.log('got a socket'); |
|
|
}, 200); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
req.setTimeout(10); |
|
|
req.socket.on('connect', function() { |
|
|
|
|
|
console.log('socket connected'); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
req.on('timeout', function() { |
|
|
setTimeout(function() { |
|
|
console.log('timeout occurred outside'); |
|
|
throw new Error('Did not get timeout event'); |
|
|
req.destroy(); |
|
|
}, 200); |
|
|
server.close(); |
|
|
}); |
|
|
process.exit(0); |
|
|
|
|
|
|
|
|
req.on('timeout', function() { |
|
|
|
|
|
console.log('timeout occurred outside'); |
|
|
|
|
|
req.destroy(); |
|
|
|
|
|
server.close(); |
|
|
|
|
|
process.exit(0); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|