#NEWLINE# def run( self , port , challenge_type ) : #NEWLINE# #INDENT# 'Run ACME server on specified ``port``.\n\n        This method is idempotent, i.e. all calls with the same pair of\n        ``(port, challenge_type)`` will reuse the same server.\n\n        :param int port: Port to run the server on.\n        :param challenge_type: Subclass of `acme.challenges.Challenge`,\n            either `acme.challenge.HTTP01` or `acme.challenges.TLSSNI01`.\n\n        :returns: Server instance.\n        :rtype: ACMEServerMixin\n\n        ' #NEWLINE# assert ( challenge_type in ( challenges . TLSSNI01 , challenges . HTTP01 ) ) #NEWLINE# if ( port in self . _instances ) : #NEWLINE# #INDENT# return self . _instances [ port ] . server #NEWLINE# #UNINDENT# address = ( '' , port ) #NEWLINE# try : #NEWLINE# #INDENT# if ( challenge_type is challenges . TLSSNI01 ) : #NEWLINE# #INDENT# server = acme_standalone . TLSSNI01Server ( address , self . certs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# server = acme_standalone . HTTP01Server ( address , self . http_01_resources ) #NEWLINE# #UNINDENT# #UNINDENT# except socket . error as error : #NEWLINE# #INDENT# raise errors . StandaloneBindError ( error , port ) #NEWLINE# #UNINDENT# thread = threading . Thread ( target = server . serve_forever ) #NEWLINE# thread . start ( ) #NEWLINE# real_port = server . socket . getsockname ( ) [ 1 ] #NEWLINE# self . _instances [ real_port ] = self . _Instance ( server , thread ) #NEWLINE# return server