def disconnect(self):
        """ Send a stream terminator and and handle all incoming stanzas before stream closure. """
        self._owner_send('</stream:stream>')
        while self.Process(1): pass
 Send a stream terminator and and handle all incoming stanzas before stream closure. 
chrome-cordova/gcmServer/xmpp/dispatcher.py