1
1
import type * as events from '../src/events' ;
2
2
import type { Host } from '../src/types' ;
3
3
import path from 'path' ;
4
- import fs from 'fs' ;
5
4
import b from 'benny' ;
6
5
import Logger , { formatting , LogLevel , StreamHandler } from '@matrixai/logger' ;
7
6
import { suiteCommon } from './utils' ;
@@ -18,17 +17,12 @@ async function main() {
18
17
// Setting up initial state
19
18
const data1KiB = Buffer . alloc ( 1024 , 0xf0 ) ;
20
19
const host = '127.0.0.1' as Host ;
21
- const certChainPem = await fs . promises . readFile (
22
- path . resolve ( path . join ( __dirname ) , '../tests/fixtures/certs/rsa1.crt' ) ,
23
- ) ;
24
- const privKeyPem = await fs . promises . readFile (
25
- path . resolve ( path . join ( __dirname ) , '../tests/fixtures/certs/rsa1.key' ) ,
26
- ) ;
20
+ const tlsConfig = await testsUtils . generateConfig ( 'RSA' ) ;
27
21
28
22
const quicServer = new QUICServer ( {
29
23
config : {
30
- key : privKeyPem . toString ( ) ,
31
- cert : certChainPem . toString ( ) ,
24
+ key : tlsConfig . key ,
25
+ cert : tlsConfig . cert ,
32
26
verifyPeer : false ,
33
27
keepAliveIntervalTime : 1000 ,
34
28
} ,
@@ -42,11 +36,11 @@ async function main() {
42
36
logger,
43
37
} ) ;
44
38
quicServer . addEventListener (
45
- 'connection ' ,
39
+ 'serverConnection ' ,
46
40
async ( e : events . QUICServerConnectionEvent ) => {
47
41
const conn = e . detail ;
48
42
conn . addEventListener (
49
- 'stream ' ,
43
+ 'connectionStream ' ,
50
44
( streamEvent : events . QUICConnectionStreamEvent ) => {
51
45
const stream = streamEvent . detail ;
52
46
void Promise . allSettled ( [
0 commit comments