code: func (cp *ProviderFactory) FlakeyProvider(connAttemptResults ConnectAttemptResults, opts ...Opt) api.ConnectionProvider {
  	var connectAttempt Attempt
  	return func(ctx context.Client, cfg fab.ChannelCfg, peer fab.Peer) (api.Connection, error) {
  		connectAttempt++
  
  		result, ok := connAttemptResults[connectAttempt]
  		if !ok {
  			return nil, errors.New("simulating failed connection attempt")
  		}
  
  		cp.mtx.Lock()
  		defer cp.mtx.Unlock()
  
  		cp.connection = result.ConnFactory(opts...)
  
  		return cp.connection, nil
  	}
  }
docs: // FlakeyProvider creates a connection provider that returns a connection according to the given
  // connection attempt results. The results tell the connection provider whether or not to fail,
  // to return a connection, what authorization to give the connection, etc.