1'use strict'; 2const common = require('../common'); 3 4// This test ensures that socket.connect can be called without callback 5// which is optional. 6 7const net = require('net'); 8 9const server = net.createServer(common.mustCall(function(conn) { 10 conn.end(); 11 server.close(); 12})).listen(0, common.mustCall(function() { 13 const client = new net.Socket(); 14 15 client.on('ready', common.mustCall(function() { 16 client.end(); 17 })); 18 19 client.connect(server.address()); 20})); 21