Created
May 21, 2010 00:37
-
-
Save ry/408328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('../common'); | |
sys = require('sys'); | |
net = require('net'); | |
gotConnect = false; | |
gotClose = false; | |
server = net.createServer(function (s) { | |
s.destroy(); | |
server.close(); | |
}); | |
server.listen(9090); | |
server.addListener('listening', function ( ) { | |
var connection = net.createConnection(9090); | |
connection.addListener('connect', function () { | |
gotConnect = true; | |
sys.debug('connect event'); | |
}); | |
connection.addListener('close', function () { | |
gotClose = true; | |
sys.debug('connect event'); | |
}); | |
}); | |
process.addListener('exit', function () { | |
assert.ok(gotConnect); | |
assert.ok(gotClose); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment