code: func NewIOSessionPool(initialCap, maxCap int, factory Factory) (IOSessionPool, error) {
  	if initialCap < 0 || maxCap <= 0 || initialCap > maxCap {
  		return nil, errors.New("invalid capacity settings")
  	}
  
  	c := &channelPool{
  		conns:   make(chan IOSession, maxCap),
  		factory: factory,
  	}
  
  	// create initial connections, if something goes wrong,
  	// just close the pool error out.
  	for i := 0; i < initialCap; i++ {
  		conn, err := factory()
  		if err != nil {
  			c.Close()
  			return nil, fmt.Errorf("factory is not able to fill the pool: %s", err)
  		}
  		c.conns <- conn
  	}
  
  	return c, nil
  }
docs: // NewIOSessionPool returns a new pool based on buffered channels with an initial
  // capacity and maximum capacity. Factory is used when initial capacity is
  // greater than zero to fill the pool. A zero initialCap doesn't fill the Pool
  // until a new Get() is called. During a Get(), If there is no new connection
  // available in the pool, a new connection will be created via the Factory()
  // method.