def _createClient(self, port): sslctx = sslutils.create_ssl_context() def is_ipv6_address(a): return (':' in a) and a.startswith('[') and a.endswith(']') if is_ipv6_address(self.remoteHost): host = self.remoteHost[1:-1] else: host = self.remoteHost client_socket = utils.create_connected_socket(host, int(port), sslctx) return self._vm.cif.createStompClient(client_socket)
def _connectToBroker(self): if config.getboolean('vars', 'broker_enable'): broker_address = config.get('addresses', 'broker_address') broker_port = config.getint('addresses', 'broker_port') request_queues = config.get('addresses', 'request_queues') sslctx = sslutils.create_ssl_context() sock = socket.socket() sock.connect((broker_address, broker_port)) if sslctx: sock = sslctx.wrapSocket(sock) self._broker_client = StompClient(sock, self._reactor) for destination in request_queues.split(","): self._subscriptions[destination] = StompRpcServer( self.servers['jsonrpc'].server, self._broker_client, destination, broker_address, config.getint('vars', 'connection_stats_timeout'), self)
def _connectToBroker(self): if config.getboolean('vars', 'broker_enable'): broker_address = config.get('addresses', 'broker_address') broker_port = config.getint('addresses', 'broker_port') request_queues = config.get('addresses', 'request_queues') sslctx = sslutils.create_ssl_context() sock = socket.socket() sock.connect((broker_address, broker_port)) if sslctx: sock = sslctx.wrapSocket(sock) self._broker_client = StompClient(sock, self._reactor) for destination in request_queues.split(","): self._subscriptions[destination] = StompRpcServer( self.bindings['jsonrpc'].server, self._broker_client, destination, broker_address, config.getint('vars', 'connection_stats_timeout') )
def _createAcceptor(self, host, port): sslctx = sslutils.create_ssl_context() self._reactor = Reactor() self._acceptor = MultiProtocolAcceptor(self._reactor, host, port, sslctx)
def _createClient(self, port): sslctx = sslutils.create_ssl_context() client_socket = utils.create_connected_socket( self.remoteHost, int(port), sslctx) return self._vm.cif.createStompClient(client_socket)