code: function loginWithIdentity (identity, hubhost, hubport) {
    debug('create xmpp client using retrieved identity token: ' + identity)
  
    var deferred = Q.defer()
    var jid = identity + '@connect.logitech.com/gatorade'
    var password = identity
    var xmppClient = new Client({
      jid: jid,
      password: password,
      host: hubhost,
      port: hubport,
      disallowTLS: true
    })
  
    xmppClient.on('error', function (e) {
      debug('XMPP login error', e)
      xmppClient.end()
      deferred.reject(e)
    })
  
    xmppClient.once('online', function () {
      debug('XMPP client connected using identity token')
      deferred.resolve(xmppClient)
    })
  
    return deferred.promise
  }
docs: PrivateFunction: loginWithIdentity
  After fetching an identity from the Harmony hub, this function creates an
  XMPP client using that identity. It returns a promise which, when resolved,
  passes that XMPP client.
  
  Parameters:
  (String) identity - Identity token to login to the Harmony hub.
  (String) hubhost - Hostname/IP of the Harmony hub to connect.
  (int) hubport - Optional. Port of the Harmony hub to connect. By default,
  this is set to 5222.
  
  Returns:
  (Q.promise) - When resolved, passes the logged in XMPP client, ready to
  communicate with the Harmony hub.