diff --git a/tests/network/Proxy.test.ts b/tests/network/Proxy.test.ts index 37c984c9d3..5e6bccd5c0 100644 --- a/tests/network/Proxy.test.ts +++ b/tests/network/Proxy.test.ts @@ -640,7 +640,7 @@ describe(Proxy.name, () => { }); utpConn.on('end', async () => { utpConn.destroy(); - }) + }); const tlsSocket = new tls.TLSSocket(utpConn, { key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'), cert: Buffer.from(serverCertPem, 'ascii'), @@ -759,7 +759,7 @@ describe(Proxy.name, () => { }); utpConn.on('end', async () => { utpConn.destroy(); - }) + }); const tlsSocket = new tls.TLSSocket(utpConn, { key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'), cert: Buffer.from(serverCertPem, 'ascii'), @@ -885,7 +885,7 @@ describe(Proxy.name, () => { }); utpConn.on('end', async () => { utpConn.destroy(); - }) + }); const tlsSocket = new tls.TLSSocket(utpConn, { key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'), cert: Buffer.from(serverCertPem, 'ascii'), @@ -1165,7 +1165,7 @@ describe(Proxy.name, () => { }); utpConn.on('end', async () => { utpConn.destroy(); - }) + }); const tlsSocket = new tls.TLSSocket(utpConn, { key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'), cert: Buffer.from(serverCertPem, 'ascii'), @@ -2316,11 +2316,7 @@ describe(Proxy.name, () => { const utpSocketPort = utpSocket.address().port; const timer = timerStart(3000); await expect( - proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - timer, - ), + proxy.openConnectionReverse(localHost, utpSocketPort as Port, timer), ).rejects.toThrow(networkErrors.ErrorConnectionStartTimeout); timerStop(timer); await expect(serverConnP).resolves.toBeUndefined(); @@ -2370,15 +2366,9 @@ describe(Proxy.name, () => { const utpSocketBind = promisify(utpSocket.bind).bind(utpSocket); await utpSocketBind(0, localHost); const utpSocketPort = utpSocket.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort as Port); expect(proxy.getConnectionReverseCount()).toBe(1); - await proxy.closeConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.closeConnectionReverse(localHost, utpSocketPort as Port); await expect(serverConnP).resolves.toBeUndefined(); await expect(serverConnClosedP).resolves.toBeUndefined(); utpSocket.off('message', handleMessage); @@ -2444,23 +2434,11 @@ describe(Proxy.name, () => { const utpSocketBind2 = promisify(utpSocket2.bind).bind(utpSocket2); await utpSocketBind2(0, localHost); const utpSocketPort2 = utpSocket2.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort1 as Port, - ); - await proxy.openConnectionReverse( - localHost, - utpSocketPort2 as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort1 as Port); + await proxy.openConnectionReverse(localHost, utpSocketPort2 as Port); expect(proxy.getConnectionReverseCount()).toBe(2); - await proxy.closeConnectionReverse( - localHost, - utpSocketPort1 as Port, - ); - await proxy.closeConnectionReverse( - localHost, - utpSocketPort2 as Port, - ); + await proxy.closeConnectionReverse(localHost, utpSocketPort1 as Port); + await proxy.closeConnectionReverse(localHost, utpSocketPort2 as Port); expect(proxy.getConnectionReverseCount()).toBe(0); await expect(serverConnP).resolves.toBeUndefined(); await expect(serverConnClosedP).resolves.toBeUndefined(); @@ -2515,10 +2493,7 @@ describe(Proxy.name, () => { const utpSocketBind = promisify(utpSocket.bind).bind(utpSocket); await utpSocketBind(0, localHost); const utpSocketPort = utpSocket.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort as Port); expect(proxy.getConnectionReverseCount()).toBe(1); await expect(serverConnP).resolves.toBeUndefined(); // The server receives the end confirmation for graceful exit @@ -2560,7 +2535,8 @@ describe(Proxy.name, () => { await proxy.start({ serverHost: serverHost(), serverPort: serverPort(), - + forwardHost: localHost, + proxyHost: localHost, tlsConfig: { keyPrivatePem: keyPairPem.privateKey, certChainPem: certPem, @@ -2583,10 +2559,7 @@ describe(Proxy.name, () => { const utpSocketBind = promisify(utpSocket.bind).bind(utpSocket); await utpSocketBind(0, localHost); const utpSocketPort = utpSocket.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort as Port); expect(proxy.getConnectionReverseCount()).toBe(1); // This retries multiple times // This will eventually fail and trigger a ErrorConnectionComposeTimeout @@ -2675,10 +2648,7 @@ describe(Proxy.name, () => { const utpSocketBind = promisify(utpSocket.bind).bind(utpSocket); await utpSocketBind(0, localHost); const utpSocketPort = utpSocket.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort as Port); expect(proxy.getConnectionReverseCount()).toBe(1); const { p: tlsSocketClosedP, resolveP: resolveTlsSocketClosedP } = promise(); @@ -2794,10 +2764,7 @@ describe(Proxy.name, () => { }; await utpSocketBind(0, localHost); const utpSocketPort = utpSocket.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort as Port); const utpConn = utpSocket.connect(proxyPort, proxyHost); const tlsSocket = tls.connect( { @@ -2828,10 +2795,7 @@ describe(Proxy.name, () => { await clientReadyP; await clientSecureConnectP; await serverConnP; - await proxy.closeConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.closeConnectionReverse(localHost, utpSocketPort as Port); expect(proxy.getConnectionReverseCount()).toBe(0); await clientCloseP; await serverConnEndP; @@ -2898,10 +2862,7 @@ describe(Proxy.name, () => { }; await utpSocketBind(0, localHost); const utpSocketPort = utpSocket.address().port; - await proxy.openConnectionReverse( - localHost, - utpSocketPort as Port, - ); + await proxy.openConnectionReverse(localHost, utpSocketPort as Port); const utpConn = utpSocket.connect(proxyPort, proxyHost); const tlsSocket = tls.connect( {