title: GCM connection error
body: <p>I am trying out implementing gcm server application using XMPP(CCS) and i cant able to connect to the google servers.
  I am trying out the sample code from <a href="http://developer.android.com/google/gcm/ccs.html" rel="nofollow">http://developer.android.com/google/gcm/ccs.html</a></p>
  
  <p>when i try to connect</p>
  
  <pre><code>ccsClient.connect(userName, password); 
  </code></pre>
  
  <p>i get the following error</p>
  
  <pre><code>gcm.googleapis.com:5235 Exception: XMPPError connecting to gcm.googleapis.com:5235.; : remote-server-error(502)
    -- caused by: XMPPError connecting to gcm.googleapis.com:5235.: remote-server-error(502) XMPPError connecting to gcm.googleapis.com:5235.
    -- caused by: java.net.ConnectException: Connection timed out: connect
      at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:592)
      at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
      at SmackCcsClient.connect(SmackCcsClient.java:249)
      at Sample.main(Sample.java:342)
  Nested Exception: 
  XMPPError connecting to gcm.googleapis.com:5235.: remote-server-error(502) XMPPError connecting to gcm.googleapis.com:5235.
    -- caused by: java.net.ConnectException: Connection timed out: connect
      at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:565)
      at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
      at SmackCcsClient.connect(SmackCcsClient.java:249)
      at Sample.main(Sample.java:342)
  Nested Exception: 
  java.net.ConnectException: Connection timed out: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(Unknown Source)
      at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.&lt;init&gt;(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
      at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:557)
      at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
      at SmackCcsClient.connect(SmackCcsClient.java:249)
      at Sample.main(Sample.java:342)
  Exception in thread "main" java.lang.NoClassDefFoundError: SmackCcsClient$GcmPacketExtension
      at SmackCcsClient.send(SmackCcsClient.java:130)
      at Sample.main(Sample.java:357)
  Caused by: java.lang.ClassNotFoundException: SmackCcsClient$GcmPacketExtension
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 2 more
  </code></pre>
  
  <p>I am using server key for the API key(password) 
  and username="project number"+"@gcm.googleapis.com"</p>
  
  <p>My project is whitelisted for upstream messaging
  Ports considered to be closed are made open at my workplace. 5228, 5229, and 5230 for my IP.
  which Ip should i use to open up the ports? public Ip or the other one?</p>
  
  <p>What could be the problem?
  Please help me resolve this! Thanks in advance</p>