function createChannelConnection (
  address,
  config,
  errorHandler,
  log,
  clientCertificate,
  serversideRouting = null,
  ssrCallback,
  createChannel = channelConfig => new Channel(channelConfig)
) {
  const channelConfig = new ChannelConfig(
    address,
    config,
    errorHandler.errorCode(),
    clientCertificate
  )

  const channel = createChannel(channelConfig)

  return Bolt.handshake(channel, log)
    .then(({ protocolVersion: version, consumeRemainingBuffer }) => {
      const chunker = new Chunker(channel)
      const dechunker = new Dechunker()
      const createProtocol = conn =>
        Bolt.create({
          version,
          channel,
          chunker,
          dechunker,
          disableLosslessIntegers: config.disableLosslessIntegers,
          useBigInt: config.useBigInt,
          serversideRouting,
          server: conn.server,
          log: conn.logger,
          observer: {
            onObserversCountChange: conn._handleOngoingRequestsNumberChange.bind(conn),
            onError: conn._handleFatalError.bind(conn),
            onFailure: conn._resetOnFailure.bind(conn),
            onProtocolError: conn._handleProtocolError.bind(conn),
            onErrorApplyTransformation: error =>
              conn.handleAndTransformError(error, conn._address)
          }
        })

      const connection = new ChannelConnection(
        channel,
        errorHandler,
        address,
        log,
        config.disableLosslessIntegers,
        serversideRouting,
        chunker,
        config.notificationFilter,
        createProtocol,
        config.telemetryDisabled,
        ssrCallback
      )

      // forward all pending bytes to the dechunker
      consumeRemainingBuffer(buffer => dechunker.write(buffer))

      return connection
    })
    .catch(reason =>
      channel.close().then(() => {
        throw reason
      })
    )
}
Crete new connection to the provided address. Returned connection is not connected.
@param {ServerAddress} address - the Bolt endpoint to connect to.
@param {Object} config - the driver configuration.
@param {ConnectionErrorHandler} errorHandler - the error handler for connection errors.
@param {Logger} log - configured logger.
@param {clientCertificate} clientCertificate - configured client certificate
@param ssrCallback - callback function used to update the counts of ssr enabled and disabled connections
@param createChannel - function taking a channelConfig object and creating a channel with it
@return {Connection} - new connection.