def plugout(self):
        """ Disconnect from the remote server and unregister self.disconnected method from
            the owner's dispatcher. """
        self._sock.close()
        if self._owner.__dict__.has_key('Connection'):
            del self._owner.Connection
            self._owner.UnregisterDisconnectHandler(self.disconnected)
 Disconnect from the remote server and unregister self.disconnected method from
            the owner's dispatcher. 
chrome-cordova/gcmServer/xmpp/transports.py