use NewGatewayClient
apnsagent: fix Close() to wait to complete all requess.