def _cbSubsystem(self, result): self.client = amp.AMP() self.client.makeConnection(self) self.dataReceived = self.client.dataReceived self.client.callRemote(server.OfferShell).addCallback( self._cbDone).addErrback(self._ebFailed)
def test_sillyEmptyThing(self): """ Test that empty boxes raise an error; they aren't supposed to be sent on purpose. """ a = amp.AMP() return self.assertRaises(amp.NoEmptyBoxes, a.ampBoxReceived, amp.Box())
def initiate(self, gameMode): self.gameMode = gameMode point = TCP4ClientEndpoint(reactor, "localhost", self.port) self.deferred = connectProtocol(point, amp.AMP()) self.deferred.addCallback(self.handshakeMaster) self.deferred.addCallback(self.recieveHubsPort) self.deferred.addCallback(self.applyNewPort) reactor.callLater(3, self.switchConnectionToHub)
def __init__(self, description, wwu): if isinstance(wwu, str): klass = reflect.namedObject(wwu) wwu = klass(self) WireWorkerUniverse.check(wwu) self.factory = Factory() self.factory.protocol = lambda: amp.AMP(locator=wwu) endpoint = endpoints.serverFromString(reactor, description) self.service = StreamServerEndpointService(endpoint, self.factory)
def makeService(self, options): application = pyramid_dynamic.application pool = threadpool.ThreadPool(minthreads=1, maxthreads=100) reactor.callWhenRunning(pool.start) reactor.addSystemEventTrigger('after', 'shutdown', pool.stop) root = wsgi.WSGIResource(reactor, pool, application) site = server.Site(root) control = protocol.Factory() control.protocol = lambda: amp.AMP(locator=AppConfiguration()) ret = service.MultiService() strports.service('tcp:8000', site).setServiceParent(ret) strports.service('tcp:8001', control).setServiceParent(ret) return ret
def buildProtocol(self, addr): protocol = amp.AMP() self.forwarder.protocols.append(protocol) return protocol
def buildProtocol(self, addr): disp = amp.BoxDispatcher(self.responder) a = amp.AMP(boxReceiver=disp, locator=self.responder) a.factory = self return a
def switchConnectionToHub(self): point = TCP4ClientEndpoint(reactor, "localhost", self.port) self.deferred = connectProtocol(point, amp.AMP()) self.deferred.addCallback(self.handshakeHub) self.deferred.addCallback(self.receiveID) self.deferred.addCallback(self.applyID)