_setupConnectionTimeout (config, socket) {
    const timeout = config.connectionTimeout
    if (timeout) {
      const connectListener = () => {
        // connected - clear connection timeout
        socket.setTimeout(0)
      }

      const timeoutListener = () => {
        // timeout fired - not connected within configured time. cancel timeout and destroy socket
        socket.setTimeout(0)
        socket.destroy(
          newError(
            `Failed to establish connection in ${timeout}ms`,
            config.connectionErrorCode
          )
        )
      }

      socket.on('connect', connectListener)
      socket.on('timeout', timeoutListener)

      this._removeConnectionTimeoutListeners = () => {
        this._conn.off('connect', connectListener)
        this._conn.off('timeout', timeoutListener)
      }

      socket.setTimeout(timeout)
    }
  }
Setup connection timeout on the socket, if configured.
@param {ChannelConfig} config - configuration of this channel.
@param {Object} socket - `net.Socket` or `tls.TLSSocket` object.
@private