mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 14:36:08 +00:00

PR-URL: https://github.com/nodejs/node/pull/17498 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
20 lines
504 B
JavaScript
20 lines
504 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer().listen(0, connectToServer);
|
|
|
|
function connectToServer() {
|
|
const client = net.createConnection(this.address().port, () => {
|
|
common.expectsError(() => client.write(1337),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError
|
|
});
|
|
|
|
client.end();
|
|
})
|
|
.on('end', () => server.close());
|
|
}
|