@@ -13,6 +13,7 @@ describe('AWSClientBuilderV3', function () {
1313 const port = 3000
1414 let server : http . Server
1515 let requests : http . IncomingMessage [ ]
16+ let activeConnections : number
1617
1718 before ( function ( ) {
1819 server = http . createServer ( { keepAlive : true } , ( req , rsp ) => {
@@ -23,10 +24,14 @@ describe('AWSClientBuilderV3', function () {
2324 server . on ( 'request' , ( req ) => {
2425 requests . push ( req )
2526 } )
27+ server . on ( 'connection' , ( _req ) => {
28+ activeConnections ++
29+ } )
2630 } )
2731
2832 beforeEach ( function ( ) {
2933 requests = [ ]
34+ activeConnections = 0
3035 } )
3136
3237 after ( function ( ) {
@@ -42,11 +47,13 @@ describe('AWSClientBuilderV3', function () {
4247 endpoint : `http://localhost:${ port } ` ,
4348 requestHandler : httpHandler ,
4449 } )
50+ assert . strictEqual ( activeConnections , 0 )
4551 await client . send ( new DescribeSessionsCommand ( { State : 'Active' } ) )
52+ assert . strictEqual ( activeConnections , 1 )
4653 await client . send ( new DescribeSessionsCommand ( { State : 'Active' } ) )
54+ assert . strictEqual ( activeConnections , 1 )
4755
4856 assert . strictEqual ( requests [ 0 ] . headers . connection , 'keep-alive' )
4957 assert . strictEqual ( requests [ 1 ] . headers . connection , 'keep-alive' )
50- assert . strictEqual ( server . connections , 1 )
5158 } )
5259} )
0 commit comments