def _setUp(self, msgpack=False): builder = HubConnectionBuilder()\ .with_url(self.server_url, options={ "verify_ssl": False, "access_token_factory": self.login, "headers": { "mycustomheader": "mycustomheadervalue" } }) if msgpack: builder.with_hub_protocol(MessagePackHubProtocol()) builder.configure_logging(logging.WARNING)\ .with_automatic_reconnect({ "type": "raw", "keep_alive_interval": 10, "reconnect_interval": 5, "max_attempts": 5 }) self.connection = builder.build() self.connection.on("ReceiveMessage", self.receive_message) self.connection.on_open(self.on_open) self.connection.on_close(self.on_close) self._lock = threading.Lock() self.assertTrue(self._lock.acquire(timeout=30)) self.connection.start()
def _test_send(self, msgpack=False): builder = HubConnectionBuilder()\ .with_url(self.server_url, options={ "verify_ssl": False, "access_token_factory": self.login, }) if msgpack: builder.with_hub_protocol(MessagePackHubProtocol()) builder.configure_logging(logging.ERROR) self.connection = builder.build() self.connection.on_open(self.on_open) self.connection.on_close(self.on_close) self.assertRaises(requests.exceptions.ConnectionError, lambda :self.connection.start())