summaryrefslogtreecommitdiff
path: root/test/parallel/test-quic-quicsocket-close.js
blob: 03aaf5281f4521e36e9af135b14aa0f5daf03c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Flags: --no-warnings
'use strict';

const common = require('../common');
if (!common.hasQuic)
  common.skip('missing quic');

const assert = require('assert');
const { createQuicSocket } = require('net');

const socket = createQuicSocket();
socket.on('close', common.mustCall());

(async function() {
  await socket.close();
  assert.rejects(() => socket.close(), {
    code: 'ERR_INVALID_STATE'
  });
})().then(common.mustCall());