Refactor HTTP client. Base setup for gcm both in the server and client.