GCM connection using Smack

Hi there.

I’m trying to use the library to connect to GCM server exactly like google indicates http://developer.android.com/google/gcm/ccs.html#implement

But when I connect using debug I can see that sequency

Client sends:

<stream:stream to=“gcm.googleapis.com” version=“1.0” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams”>

Server:

<str:features xmlns:str=“http://etherx.jabber.org/streams”>

X-OAUTH2
X-GOOGLE-TOKEN
PLAIN

</str:features>

Client:

MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hbmFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJK V1d0dw==

</stream:stream>

As can you see, the close tag stream is sent after the auth, the specification requires this sequence:

See? the stream tag is auto closed, I thing the problem is there.

Client

<stream:stream to="gcm.googleapis.com"
        version="1.0" xmlns="jabber:client"
        xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)"/>

Server

<str:features xmlns:str="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)">
 <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
   <mechanism>X-OAUTH2</mechanism>
   <mechanism>X-GOOGLE-TOKEN</mechanism>
   <mechanism>PLAIN</mechanism>
 </mechanisms>
</str:features>

Client

<auth mechanism="PLAIN"
xmlns="urn:ietf:params:xml:ns:xmpp-sasl">MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hb
mFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJKV1d0dw==</auth>

Server

<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>

Basicaly the implementarion is this:

ConnectionConfiguration config = new ConnectionConfiguration(GCM_SERVER, GCM_PORT);

config.setSecurityMode(SecurityMode.enabled);

config.setReconnectionAllowed(true);

config.setRosterLoadedAtLogin(false);

config.setSendPresence(false);

    config.setCompressionEnabled(true);

    config.setSocketFactory(SSLSocketFactory.getDefault());

    connection = new XMPPTCPConnection(config);

connection.connect();

    connection.login(user, pwd);

I’m using version 4, using version 3 the tag stream is not even closed