connection tests

This commit is contained in:
2021-03-04 00:01:39 -06:00
parent 14a54e1780
commit 317439371b
2 changed files with 106 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ export default class connection {
});
});
} catch (err) {
return Promise.reject(`'connect()' failed: ${err}`)
return Promise.reject(new Error(`'connect()' failed: ${err}`));
}
this.connected = true;
@@ -60,7 +60,6 @@ export default class connection {
this.socket.on('data', chunk => {
buffer = buffer ? Buffer.concat([ buffer, chunk ]) : chunk;
if (buffer.length > 4) {
const size = buffer.readUInt32BE(0);
if (buffer.length >= size + 4) {