测试:删掉部分注释,修改用例名

This commit is contained in:
liangtongchuan
2021-03-05 10:51:19 +08:00
parent ca2d597947
commit cf2ee12445
6 changed files with 27 additions and 22 deletions

View File

@@ -60,7 +60,9 @@ class PinusWSClient {
this.handlers[Package.TYPE_KICK] = this.onKick;
}
init(params, cb) {
console.log('init', params);
if (PinusWSClient.DEBUG) {
console.log('init', params);
}
this.initCallback = cb;
let host = params.host;
let port = params.port;
@@ -74,7 +76,9 @@ class PinusWSClient {
this.initWebSocket(host, port, cb);
}
initWebSocket(host, port, cb) {
console.log('[Pinus] connect to:', host, port);
if (PinusWSClient.DEBUG) {
console.log('[Pinus] connect to:', host, port);
}
let url = 'ws://' + host;
if (port) {
url += ':' + port;
@@ -135,11 +139,15 @@ class PinusWSClient {
this.send(byte);
}
onConnect() {
console.log('[Pinus] connect success');
if (PinusWSClient.DEBUG) {
console.log('[Pinus] connect success');
}
this.send(this._package.encode(Package.TYPE_HANDSHAKE, Protocol.strencode(JSON.stringify(this.handshakeBuffer))));
}
onClose(e) {
console.error('[Pinus] connect close');
if (PinusWSClient.DEBUG) {
console.error('[Pinus] connect close');
}
// this.emit(Pinus.EVENT_CLOSE,e);
}
onIOError(e) {
@@ -260,7 +268,9 @@ class PinusWSClient {
this._disconnect();
}
_disconnect() {
console.warn('[Pinus] client disconnect ...');
if (PinusWSClient.DEBUG) {
console.warn('[Pinus] client disconnect ...');
}
if (this.socket)
this.socket.close();
this.socket = null;