func TestChannelClientPool_Close(t *testing.T) {
	servers := []string{
		serverAddr.String(),
	}
	var maxIdle uint32 = 1
	var timeoutMs int32 = 5
	pool := NewChannelClientPool(maxIdle, 0, servers, 0, time.Duration(timeoutMs)*time.Millisecond,
		func(openedSocket thrift.TTransport) Client {
			transport := transportFactory.GetTransport(openedSocket)
			return example.NewExampleClientFactory(transport, protocolFactory)
		},
	)
	numClients := 5
	clients := make([]PooledClient, numClients)
	for i := 0; i < numClients; i++ {
		if cli, err := pool.Get(); err != nil {
			t.Error("get client from pool failed", err)
		} else {
			clients[i] = cli
		}
	}
	pool.Close()
	for _, cli := range clients {
		cli.Close()
	}
}
func TestChannelClientPool_Get(t *testing.T) {
	servers := []string{
		serverAddr.String(),
	}
	var maxIdle uint32 = 1
	var timeoutMs int32 = 5
	pool := NewChannelClientPool(maxIdle, 0, servers, 0, time.Duration(timeoutMs)*time.Millisecond,
		func(openedSocket thrift.TTransport) Client {
			transport := transportFactory.GetTransport(openedSocket)
			return example.NewExampleClientFactory(transport, protocolFactory)
		},
	)
	func() {
		pooledClient, err := pool.Get()
		if err != nil {
			t.Error(err)
		}
		defer pooledClient.Close()
		rawClient, ok := pooledClient.RawClient().(*example.ExampleClient)
		if !ok {
			t.Error("convert to raw client failed")
		}
		if v, err := rawClient.Add(1, 2); err != nil {
			t.Error(err)
		} else if v != 3 {
			t.Error("call rpc failed")
		}
	}()
	func() {
		pooledClient, err := pool.Get()
		if err != nil {
			t.Error(err)
		}
		defer pooledClient.Close()
		rawClient := pooledClient.RawClient().(*example.ExampleClient)
		if _, err := rawClient.AddTimeout(1, 2, timeoutMs); err == nil {
			t.Error("timeout expected")
		} else {
			pooledClient.MarkUnusable()
		}
	}()
}