_connect() { this._session = http2.connect(this.url); this._session.setTimeout(this.options.connectTimeout, () => { const err = new Error('session#' + this.url + ' connect timeout(' + this.options.connectTimeout + 'ms)'); err.name = 'GRpcSessionConnectTimeoutError'; this.close(err); this.ready(err); }); this._session.once('close', () => { this._handleClose(); }); this._session.once('error', err => { this._handleSocketError(err); }); this._session.once('connect', () => { this._connected = true; this._session.setTimeout(0); const socket = this._session.socket; this._clientUrl = socket.localAddress + ':' + socket.localPort; this.ready(true); }); }