| 16 | const key = fixtures.readKey('agent3-key.pem', 'utf8'); |
| 17 | |
| 18 | function test(ca) { |
| 19 | const server = tls.createServer({ ca, cert, key }); |
| 20 | |
| 21 | server.addContext('agent3', { ca, cert, key }); |
| 22 | |
| 23 | const host = common.localhostIPv4; |
| 24 | server.listen(0, host, common.mustCall(() => { |
| 25 | const socket = tls.connect({ |
| 26 | servername: 'agent3', |
| 27 | host, |
| 28 | port: server.address().port, |
| 29 | ca |
| 30 | }, common.mustCall(() => { |
| 31 | socket.end(); |
| 32 | })); |
| 33 | |
| 34 | socket.on('close', () => { |
| 35 | server.close(); |
| 36 | }); |
| 37 | })); |
| 38 | } |
| 39 | |
| 40 | // `ca1` is not actually necessary for the certificate validation -- maybe |
| 41 | // the fixtures should be written in a way that requires it? |