def test_NSP(self):
        """
        An L{IPerspective} implementation which does not subclass
        L{Avatar} can expose remote methods for the client to call.
        """
        factory = pb.PBClientFactory()
        d = factory.login(credentials.UsernamePassword(b'user', b'pass'),
                          "BRAINS!")
        reactor.connectTCP('127.0.0.1', self.portno, factory)
        d.addCallback(lambda p: p.callRemote('ANYTHING', 'here', bar='baz'))
        d.addCallback(self.assertEqual,
                      ('ANYTHING', ('here',), {'bar': 'baz'}))
        def cleanup(ignored):
            factory.disconnect()
            for p in self.factory.protocols:
                p.transport.loseConnection()
        d.addCallback(cleanup)
        return d

        An L{IPerspective} implementation which does not subclass
        L{Avatar} can expose remote methods for the client to call.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/test/test_pb.py