title: Google Cloud Messaging - server connection
body: <p>I started to write some application using Google Cloud Messaging, but I have problem with the server. I used code from Android Developer side - Java sample using the Smack library (I will not upload code here, because it is quite long):</p>
  
  <p><a href="https://developer.android.com/google/gcm/ccs.html" rel="nofollow">GCM Cloud connection Server (XMPP)</a></p>
  
  <p>I have turn on Google Cloud Messaging on Google Apis and I changed my SENDER_ID, API KEY and Registration_ID, but when I start the program I have errors like this:</p>
  
  <pre><code>    gcm.googleapis.com:5235 Exception: XMPPError connecting to gcm.googleapis.com:5235.; : remote-server-error(502)
      at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:604)
          at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1026)
          at SmackCcsClient.connect(SmackCcsClient.java:248)
          at SmackCcsClient.main(SmackCcsClient.java:342)
      Exception in thread "main" java.lang.IllegalStateException: Not connected to server.
          at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:495)
          at SmackCcsClient.send(SmackCcsClient.java:132)
          at SmackCcsClient.main(SmackCcsClient.java:357)
  
  SmackCcsClient.java:248 -&gt; `connection.connect();`
  
  SmackCcsClient.java:342 -&gt; `ccsClient.connect(userName, password);`
  
  SmackCcsClient.java:132 -&gt; `connection.sendPacket(request);`
  
  SmackCcsClient.java:357 -&gt; `ccsClient.send(createJsonMessage(toRegId, messageId, payload, collapseKey,timeToLive, delayWhileIdle));`
  </code></pre>
  
  <p>Maybe you know what I done wrong?</p>