Пример #1
0
 def testExtractSubprotocolConnectSuccessSid(self, binary_data,
                                             expected_data,
                                             expected_bytes_left):
     data, bytes_left = utils.ExtractSubprotocolConnectSuccessSid(
         binary_data)
     self.assertEqual(data, expected_data)
     self.assertEqual(bytes_left, expected_bytes_left)
 def _HandleSubprotocolConnectSuccessSid(self, binary_data):
     """Handle Subprotocol CONNECT_SUCCESS_SID Frame."""
     data, bytes_left = utils.ExtractSubprotocolConnectSuccessSid(
         binary_data)
     self._connection_sid = data
     self._connect_msg_received = True
     if bytes_left:
         log.warning(
             'Discarding %d extra bytes after processing CONNECT_SUCCESS_SID',
             len(bytes_left))
Пример #3
0
  def _HandleSubprotocolConnectSuccessSid(self, binary_data):
    """Handle Subprotocol CONNECT_SUCCESS_SID Frame."""
    if self._HasConnected():
      self._StopConnectionAsync()
      raise SubprotocolExtraConnectSuccessSid(
          'Received CONNECT_SUCCESS_SID after already connected.')

    data, bytes_left = utils.ExtractSubprotocolConnectSuccessSid(binary_data)
    self._connection_sid = data
    self._connect_msg_received = True
    if bytes_left:
      log.debug(
          'Discarding [%d] extra bytes after processing CONNECT_SUCCESS_SID',
          len(bytes_left))
Пример #4
0
 def testExtractSubprotocolConnectSuccessSidIncompleteData(
         self, binary_data, expected_error):
     with self.AssertRaisesExceptionMatches(expected_error, ''):
         utils.ExtractSubprotocolConnectSuccessSid(binary_data)