XMPP TLS Negotiation - Using Titanium socket programming
===

I am trying to make XMPP work with [Titanium socket programming][1] .

I have taken [this][2] as a reference for handshake involved in the protocol. Am interested in 5.3.  Client-to-Server Example from the document.

Am not able to proceed further after step 5 from the document. 

    SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='gmail.com'>
    
    RECV: <stream:stream from="gmail.com" id="83C19E760EA9003B" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms></stream:features>
    
    SEND: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
    RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

After this am supposed to send a new stream to the server as in step 7.

But i get "Error: read callback called with no buffer!" from readCallback(e) method.

Am i missing something here? Have any one tried this? Need a hand here guys.


  [1]: http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.Network.Socket.TCP
  [2]: http://xmpp.org/rfcs/rfc3920.html