Skip to content

Commit

Permalink
tests: fixed write after end error in proxy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tegefaulkes committed May 26, 2022
1 parent 116a4e7 commit 5f97ff6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/network/Proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ describe(Proxy.name, () => {
utpConn.on('error', (e) => {
utpConnError(e);
});
utpConn.on('end', async () => {
utpConn.destroy();
})
const tlsSocket = new tls.TLSSocket(utpConn, {
key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'),
cert: Buffer.from(serverCertPem, 'ascii'),
Expand All @@ -659,7 +662,7 @@ describe(Proxy.name, () => {
tlsSocket.destroy();
} else {
logger.debug('Reverse: responds tlsSocket ending');
tlsSocket.end();
utpConn.end();
tlsSocket.destroy();
}
});
Expand Down Expand Up @@ -754,6 +757,9 @@ describe(Proxy.name, () => {
utpConn.on('error', (e) => {
utpConnError(e);
});
utpConn.on('end', async () => {
utpConn.destroy();
})
const tlsSocket = new tls.TLSSocket(utpConn, {
key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'),
cert: Buffer.from(serverCertPem, 'ascii'),
Expand All @@ -775,7 +781,7 @@ describe(Proxy.name, () => {
tlsSocket.destroy();
} else {
logger.debug('Reverse: responds tlsSocket ending');
tlsSocket.end();
utpConn.end();
tlsSocket.destroy();
}
});
Expand Down Expand Up @@ -877,6 +883,9 @@ describe(Proxy.name, () => {
utpConn.on('error', (e) => {
utpConnError(e);
});
utpConn.on('end', async () => {
utpConn.destroy();
})
const tlsSocket = new tls.TLSSocket(utpConn, {
key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'),
cert: Buffer.from(serverCertPem, 'ascii'),
Expand All @@ -898,7 +907,7 @@ describe(Proxy.name, () => {
tlsSocket.destroy();
} else {
logger.debug('Reverse: responds tlsSocket ending');
tlsSocket.end();
utpConn.end();
tlsSocket.destroy();
logger.debug('Reverse: responded tlsSocket ending');
}
Expand Down Expand Up @@ -1154,6 +1163,9 @@ describe(Proxy.name, () => {
utpConn.on('error', (e) => {
utpConnError(e);
});
utpConn.on('end', async () => {
utpConn.destroy();
})
const tlsSocket = new tls.TLSSocket(utpConn, {
key: Buffer.from(serverKeyPairPem.privateKey, 'ascii'),
cert: Buffer.from(serverCertPem, 'ascii'),
Expand All @@ -1175,7 +1187,7 @@ describe(Proxy.name, () => {
tlsSocket.destroy();
} else {
logger.debug('Reverse: responds tlsSocket ending');
tlsSocket.end();
utpConn.end();
tlsSocket.destroy();
logger.debug('Reverse: responded tlsSocket ending');
}
Expand Down

0 comments on commit 5f97ff6

Please sign in to comment.