2020-11-08 19:56:56 +01:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const net = require('net');
|
|
|
|
|
|
|
|
const server = net.createServer(common.mustCall(function(s) {
|
|
|
|
server.close();
|
|
|
|
s.end();
|
2020-01-29 13:12:15 +01:00
|
|
|
})).listen(0, '127.0.0.1', common.mustCall(function() {
|
|
|
|
const socket = net.connect(this.address().port, '127.0.0.1');
|
2020-11-08 19:56:56 +01:00
|
|
|
socket.on('end', common.mustCall(() => {
|
|
|
|
assert.strictEqual(socket.writable, true);
|
|
|
|
socket.write('hello world');
|
|
|
|
}));
|
|
|
|
}));
|