summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-wrap-econnreset-pipe.js
blob: b400e35d412392e5ac620c3d47306da3cf6d11d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';

const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');

const assert = require('assert');
const tls = require('tls');
const net = require('net');

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();

const server = net.createServer((c) => {
  c.end();
}).listen(common.PIPE, common.mustCall(() => {
  tls.connect({ path: common.PIPE })
    .once('error', common.mustCall((e) => {
      assert.strictEqual(e.code, 'ECONNRESET');
      assert.strictEqual(e.path, common.PIPE);
      assert.strictEqual(e.port, undefined);
      assert.strictEqual(e.host, undefined);
      assert.strictEqual(e.localAddress, undefined);
      server.close();
    }));
}));