* Handle incoming data from the socket
(data)
| 10635 | * Handle incoming data from the socket |
| 10636 | */ |
| 10637 | onData(data) { |
| 10638 | debug("received data", data.length, "bytes in state", this.state); |
| 10639 | this.buffer = Buffer2.concat([this.buffer, data]); |
| 10640 | try { |
| 10641 | switch (this.state) { |
| 10642 | case STATES.HANDSHAKING: |
| 10643 | this.handleHandshakeResponse(); |
| 10644 | break; |
| 10645 | case STATES.AUTHENTICATING: |
| 10646 | this.handleAuthResponse(); |
| 10647 | break; |
| 10648 | case STATES.CONNECTING: |
| 10649 | this.handleConnectResponse(); |
| 10650 | break; |
| 10651 | } |
| 10652 | } catch (err) { |
| 10653 | this.onError(err); |
| 10654 | } |
| 10655 | } |
| 10656 | /** |
| 10657 | * Handle socket errors |
| 10658 | */ |
no test coverage detected