func (p *chanPool) getConnsAndFactory() (chan *ReverseProxy, Factory) {
	p.mutex.RLock()
	reverseProxyChan, factory := p.reverseProxyChan, p.factory
	p.mutex.RUnlock()
	return reverseProxyChan, factory
}
getConnsAndFactory ... get a copy of chanPool's reverseProxyChan and factory
package proxy
import (
	"errors"
	"sync"
)
var (
	errFactoryNotHelp         = errors.New("factory is not able to fill the pool")
	errInvalidCapacitySetting = errors.New("invalid capacity settings")
)
type chanPool struct {
	mutex sync.RWMutex
	reverseProxyChan chan *ReverseProxy
	factory Factory
}
type Factory func(string) (*ReverseProxy, error)
func NewChanPool(initialCap, maxCap int, factory Factory) (Pool, error) {
	if initialCap < 0 || maxCap <= 0 || initialCap > maxCap {
		return nil, errInvalidCapacitySetting
	}
	pool := &chanPool{
		mutex:            sync.RWMutex{},
		reverseProxyChan: make(chan *ReverseProxy, maxCap),
		factory:          factory,
	}
	for i := 0; i < initialCap; i++ {
		proxy, err := factory("")
		if err != nil {
			proxy.Close()
			return nil, errFactoryNotHelp
		}
		pool.reverseProxyChan <- proxy
	}
	return pool, nil
}