Ejemplo n.º 1
0
 def __init__(self, test, requestsPerSocket=3, socketCount=2):
     # Similar to MaxRequests in the configuration.
     self.requestsPerSocket = requestsPerSocket
     # Similar to ProcessCount in the configuration.
     self.socketCount = socketCount
     self.limiter = ConnectionLimiter(2,
                                      maxRequests=requestsPerSocket *
                                      socketCount)
     self.dispatcher = self.limiter.dispatcher
     self.dispatcher.reactor = ReaderAdder()
     self.service = Service()
     self.limiter.addPortService("TCP", 4321, "127.0.0.1", 5,
                                 self.serverServiceMakerMaker(self.service))
     for ignored in xrange(socketCount):
         subskt = self.dispatcher.addSocket()
         subskt.start()
         subskt.restarted()
     # Has to be running in order to add stuff.
     self.limiter.startService()
     self.port = self.service.myPort
Ejemplo n.º 2
0
 def setUp(self):
     self.dispatcher = InheritedSocketDispatcher(ConnectionLimiter(2, 20))
     self.dispatcher.reactor = ReaderAdder()