blob: 27b7c338c9a79444f61f737cab3838d31ba0421e (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
'use strict';
const {
hasCrypto,
mustCall,
skip
} = require('../common');
if (!hasCrypto)
skip('missing crypto');
const {
strictEqual
} = require('assert');
const {
createServer,
connect
} = require('http2');
const {
spawnSync
} = require('child_process');
// Validate that there is no unexpected output when
// using http2
if (process.argv[2] !== 'child') {
const {
stdout, stderr, status
} = spawnSync(process.execPath, [__filename, 'child'], { encoding: 'utf8' });
strictEqual(stderr, '');
strictEqual(stdout, '');
strictEqual(status, 0);
} else {
const server = createServer();
server.listen(0, mustCall(() => {
const client = connect(`http://localhost:${server.address().port}`);
client.on('connect', mustCall(() => {
client.close();
server.close();
}));
}));
}
|