11import type * as events from '../src/events' ;
22import type { Host } from '../src/types' ;
33import path from 'path' ;
4- import fs from 'fs' ;
54import b from 'benny' ;
65import Logger , { formatting , LogLevel , StreamHandler } from '@matrixai/logger' ;
76import { suiteCommon } from './utils' ;
@@ -18,17 +17,12 @@ async function main() {
1817 // Setting up initial state
1918 const data1KiB = Buffer . alloc ( 1024 , 0xf0 ) ;
2019 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' ) ;
2721
2822 const quicServer = new QUICServer ( {
2923 config : {
30- key : privKeyPem . toString ( ) ,
31- cert : certChainPem . toString ( ) ,
24+ key : tlsConfig . key ,
25+ cert : tlsConfig . cert ,
3226 verifyPeer : false ,
3327 keepAliveIntervalTime : 1000 ,
3428 } ,
@@ -42,11 +36,11 @@ async function main() {
4236 logger,
4337 } ) ;
4438 quicServer . addEventListener (
45- 'connection ' ,
39+ 'serverConnection ' ,
4640 async ( e : events . QUICServerConnectionEvent ) => {
4741 const conn = e . detail ;
4842 conn . addEventListener (
49- 'stream ' ,
43+ 'connectionStream ' ,
5044 ( streamEvent : events . QUICConnectionStreamEvent ) => {
5145 const stream = streamEvent . detail ;
5246 void Promise . allSettled ( [
0 commit comments