'Assert that L{PBClientFactory.getRootObject}\'s Deferred fires with
a L{RemoteReference}, and that disconnecting it runs its
disconnection callbacks.'

def test_getRootObject(self):

    self.establishClientAndServer()
    rootObjDeferred = self.clientFactory.getRootObject()
    def gotRootObject(rootObj):
        self.assertIsInstance(rootObj, pb.RemoteReference)
        return rootObj
    def disconnect(rootObj):
        disconnectedDeferred = Deferred()
        rootObj.notifyOnDisconnect(disconnectedDeferred.callback)
        self.clientFactory.disconnect()
        self.completeClientLostConnection()
        return disconnectedDeferred
    rootObjDeferred.addCallback(gotRootObject)
    rootObjDeferred.addCallback(disconnect)
    return rootObjDeferred
