summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-connect-options.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-net-connect-options.js')
-rw-r--r--test/parallel/test-net-connect-options.js30
1 files changed, 10 insertions, 20 deletions
diff --git a/test/parallel/test-net-connect-options.js b/test/parallel/test-net-connect-options.js
index 302a8a9bbc..3446790d7b 100644
--- a/test/parallel/test-net-connect-options.js
+++ b/test/parallel/test-net-connect-options.js
@@ -1,42 +1,32 @@
'use strict';
-require('../common');
+const common = require('../common');
var assert = require('assert');
var net = require('net');
-var serverGotEnd = false;
-var clientGotEnd = false;
-
-var server = net.createServer({allowHalfOpen: true}, function(socket) {
+var server = net.createServer({
+ allowHalfOpen: true
+}, common.mustCall(function(socket) {
socket.resume();
- socket.on('end', function() {
- serverGotEnd = true;
- });
+ socket.on('end', common.mustCall(function() {}));
socket.end();
-});
+}));
server.listen(0, function() {
var client = net.connect({
host: '127.0.0.1',
port: this.address().port,
allowHalfOpen: true
- }, function() {
+ }, common.mustCall(function() {
console.error('client connect cb');
client.resume();
- client.on('end', function() {
- clientGotEnd = true;
+ client.on('end', common.mustCall(function() {
setTimeout(function() {
assert(client.writable);
client.end();
}, 10);
- });
+ }));
client.on('close', function() {
server.close();
});
- });
-});
-
-process.on('exit', function() {
- console.error('exit', serverGotEnd, clientGotEnd);
- assert(serverGotEnd);
- assert(clientGotEnd);
+ }));
});