mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 07:27:22 +01:00
f133c16f5d
PR-URL: https://github.com/nodejs/node/pull/9666 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
27 lines
618 B
JavaScript
27 lines
618 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
const tls = require('tls');
|
|
|
|
const server = net.createServer(common.mustCall((c) => {
|
|
c.destroy();
|
|
})).listen(0, common.mustCall(() => {
|
|
const c = tls.connect({ port: server.address().port });
|
|
c.on('error', () => {
|
|
// Otherwise `.write()` callback won't be invoked.
|
|
c.destroyed = false;
|
|
});
|
|
|
|
c.write('hello', common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ECANCELED');
|
|
server.close();
|
|
}));
|
|
}));
|