コード例 #1
0
 def setUp(self):
     SimulatedNetwork.clear()
     self.aliceReceivedRequests = []
     self.aliceReceivedResponses = []
     self.atlantaReceivedRequests = []
     self.atlantaReceivedResponses = []
     self.biloxiReceivedRequests = []
     self.biloxiReceivedResponses = []
     self.bobReceivedRequests = []
     self.bobReceivedResponses = []
     self.atlanta = SIPStatelessProxy()
     self.atlanta.transports = [SimulatedSIPTransport(self.atlantaBindAddress, self.atlantaBindPort)]
     self.biloxi = SIPStatelessProxy()
     self.biloxi.transports = [SimulatedSIPTransport(self.biloxiBindAddress, self.biloxiBindPort)]
     self.aliceTransport = SimulatedSIPTransport(self.aliceBindAddress, self.aliceBindPort)
     self.bobTransport = SimulatedSIPTransport(self.bobBindAddress, self.bobBindPort)
     self.aliceTransport.whenEventDo("receivedValidConnectedRequest", self.aliceRequestEventHandler)
     self.aliceTransport.whenEventDo("receivedValidConnectedResponse", self.aliceResponseEventHandler)
     self.atlanta.transports[0].whenEventDo("receivedValidConnectedRequest", self.atlantaRequestEventHandler)
     self.atlanta.transports[0].whenEventDo("receivedValidConnectedResponse", self.atlantaResponseEventHandler)
     self.biloxi.transports[0].whenEventDo("receivedValidConnectedRequest", self.biloxiRequestEventHandler)
     self.biloxi.transports[0].whenEventDo("receivedValidConnectedResponse", self.biloxiResponseEventHandler)
     self.bobTransport.whenEventDo("receivedValidConnectedRequest", self.bobRequestEventHandler)
     self.bobTransport.whenEventDo("receivedValidConnectedResponse", self.bobResponseEventHandler)
     self.aliceTransport.bind()
     self.bobTransport.bind()
     self.aliceTransport.connectToAddressAndPort(self.atlantaBindAddress, self.atlantaBindPort)
コード例 #2
0
 def setUp(self):
     SimulatedNetwork.clear()
     self.hasBound = False
     self.bindHasFailed = False
     self.connectedConnections = []
     self.notConnectedAddressesAndPorts = []
     self.receivedRequests = []
     self.receivedResponses = []
     self.transport1 = SimulatedSIPTransport(self.bindAddress1, self.bindPort1)
     self.transport1.whenEventDo("bound", self.boundEventHandler)
     self.transport1.whenEventDo("bindFailed", self.bindFailedEventHandler)
     self.transport1.whenEventDo("madeConnection", self.madeConnectionEventHandler)
     self.transport1.whenEventDo("couldNotMakeConnection", self.couldNotMakeConnectionEventHandler)
     self.transport1.whenEventDo("lostConnection", self.lostConnectionEventHandler)
     self.transport1.whenEventDo("receivedValidConnectedRequest", self.receivedValidConnectedRequestEventHandler)
     self.transport1.whenEventDo("receivedValidConnectedResponse", self.receivedValidConnectedResponseEventHandler)
     self.transport2 = SimulatedSIPTransport(self.bindAddress2, self.bindPort2)
     self.transport3 = SimulatedSIPTransport(self.bindAddress3, self.bindPort3)