Пример #1
0
 def connectionLost(cl_self, reason):
     logger.debug("Connection closed with reason {reason}".format(reason=reason))
     self.client = None
     if self.pinger:
         self.pinger.stop()
     self.on_close()
     WebSocketClientProtocol.connectionLost(cl_self, reason)
Пример #2
0
        def send(msg):
            binaries, jsonMsg = recursiveBinarySearch(msg)

            WebSocketClientProtocol.sendMessage(self, json.dumps(jsonMsg))

            for data in binaries:
                msg = data[0] + data[1].getvalue()
                WebSocketClientProtocol.sendMessage(self, msg, binary=True)
Пример #3
0
    def _send(self, msg, binaries):
        """ Internally used method to send messages via WebSocket connection.
            Handles the actual sending of the message. (Not thread-safe; use
            sendMessage instead.)
        """
        WebSocketClientProtocol.sendMessage(self, msg)

        for data in binaries:
            binMsg = data[0] + data[1].getvalue()
            WebSocketClientProtocol.sendMessage(self, binMsg, binary=True)
Пример #4
0
    def _send(self, msg, binaries):
        """ Internally used method to send messages via WebSocket connection.
            Handles the actual sending of the message. (Not thread-safe; use
            sendMessage instead.)
        """
        WebSocketClientProtocol.sendMessage(self, msg)

        for data in binaries:
            binMsg = data[0] + data[1].getvalue()
            WebSocketClientProtocol.sendMessage(self, binMsg, binary=True)
Пример #5
0
   def connectionMade(self):
      FuzzingProtocol.connectionMade(self)
      WebSocketClientProtocol.connectionMade(self)

      self.caseAgent = self.factory.agent
      self.case = self.factory.currentCaseIndex
      self.Case = Cases[self.case - 1]
      self.runCase = self.Case(self)
      self.caseStarted = utcnow()
      print "Running test case ID %s for agent %s from peer %s" % (caseClasstoId(self.Case), self.caseAgent, self.peerstr)
Пример #6
0
 def connectionMade(self):
    FuzzingProtocol.connectionMade(self)
    WebSocketClientProtocol.connectionMade(self)
    self.caseStarted = utcnow()
    print "Running test case ID %s for agent %s from peer %s" % (self.factory.CaseSet.caseClasstoId(self.Case), self.caseAgent, self.peerstr)
 def connectionLost(self, reason):
     print "connection lost"
     WebSocketClientProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     reactor.callLater(2, self.factory.connect)
Пример #8
0
 def sendMessage(self, payload):
     WebSocketClientProtocol.sendMessage(self, json.dumps(payload))
 def sendMessage(self, payload, binary=False):
     session_id = self.session_id if hasattr(self, "session_id") else None
     now = round(1000000 * (time.clock() - self.factory.case.started))
     rec = (now, session_id, "TX", payload)
     self.factory.case.wampLog.append(rec)
     WebSocketClientProtocol.sendMessage(self, payload, binary)
Пример #10
0
 def onMessageFrameBegin(self, length, reserved):
     #log.msg('onMessageFrameBegin: %s' % length)
     WebSocketClientProtocol.onMessageFrameBegin(self, length, reserved)
     if self.frame_num == WSCP_DATA and self.buffer_filled is not None:
         self.file_decoders[self.path].registerProducer(self, True)
Пример #11
0
 def onMessageBegin(self, opcode):
     log.msg('onMessageBegin')
     WebSocketClientProtocol.onMessageBegin(self, opcode)
Пример #12
0
 def connectionLost(self, reason):
    WebSocketClientProtocol.connectionLost(self, reason)
    FuzzingProtocol.connectionLost(self, reason)
Пример #13
0
 def sendMessage(self, msg, binary, cb):
     assert self._cb is None
     self._cb = cb
     WebSocketClientProtocol.sendMessage(self, msg, binary)
Пример #14
0
 def sendMessage(self, msg, binary, cb):
     assert self._cb is None
     self._cb = cb
     WebSocketClientProtocol.sendMessage(self, msg, binary)
Пример #15
0
 def connectionLost(self,reason):
     self.factory.connections.remove(self)
     WebSocketClientProtocol.connectionLost(self, reason)#always after your code
     reactor.stop()
Пример #16
0
 def connectionMade(self):
     WebSocketClientProtocol.connectionMade(self)#always before your code
     self.factory.connections.append(self)
Пример #17
0
 def failHandshake(self, reason):
     """ This method is called by twisted when the connection could not be
         initialized.
     """
     print(reason)
     WebSocketClientProtocol.failHandshake(self, reason)
Пример #18
0
 def failHandshake(self, reason):
     """ This method is called by twisted when the connection could not be
         initialized.
     """
     print(reason)
     WebSocketClientProtocol.failHandshake(self, reason)
Пример #19
0
 def connectionLost(self, reason):
     print 'connection lost'
     WebSocketClientProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     reactor.callLater(2, self.factory.connect)