As many other newbies to java and android i\'m trying to run gcm demo server and gcm demo client on windows, using eclipse to run vertual device and tomcat as a webserer.
This issue is not addressed well on any of the forum may be because it has multiple causes. My case was: I was doing a demo of GCM push notifications and it worked the first time. But as I proceeded next day with same code i found the exception mention in the answer. On observation, I noticed that my public IP had changed as it is not static. This IP has to be provided when you create project on google developers console. You can find your public IP by searching "my public IP address" in google. Or for demo purpose i would now strongly recommend you to use IP as 0.0.0.0/0 which is recommended and when you deploy your project, your server IP would be static. You can then replace 0.0.0.0/0 IP with your server IP. Also, check all the keys like 'project number' and 'server API key'. Hope it helps. CHEERS :)