Esempio n. 1
0
 def establish_connection(self):
     """
 Create a stomp connection
 """
     connection_url = 'wss://{0}:{1}/agent/stomp/v1'.format(
         self.config.server_hostname, self.config.secured_url_port)
     connection_helper = security.VerifiedHTTPSConnection(
         self.config.server_hostname, connection_url, self.config)
     self.connection = connection_helper.connect()
Esempio n. 2
0
 def test_Verified_HTTPSConnection_non_secure_connect(
         self, wrap_socket_mock, create_connection_mock,
         init_security_mock):
     connection = security.VerifiedHTTPSConnection(
         "example.com", self.config.get('server', 'secured_url_port'),
         self.config)
     connection._tunnel_host = False
     connection.sock = None
     connection.connect()
     self.assertFalse(init_security_mock.called)
Esempio n. 3
0
 def test_VerifiedHTTPSConnection_connect(self, wrap_socket_mock,
                                          create_connection_mock,
                                           init_security_mock):
   init_security_mock.return_value = None
   self.config.set('security', 'keysdir', '/dummy-keysdir')
   connection = security.VerifiedHTTPSConnection("example.com",
     self.config.get('server', 'secured_url_port'), self.config)
   connection._tunnel_host = False
   connection.sock = None
   connection.connect()
   self.assertTrue(wrap_socket_mock.called)
Esempio n. 4
0
 def test_Verified_HTTPSConnection_two_way_ssl_connect(self, wrap_socket_mock,
                                                   create_connection_mock,
                                                   init_security_mock):
   wrap_socket_mock.side_effect=ssl.SSLError()
   connection = security.VerifiedHTTPSConnection("example.com",
     self.config.get('server', 'secured_url_port'), self.config)
   connection._tunnel_host = False
   connection.sock = None
   try:
     connection.connect()
   except ssl.SSLError:
     pass
   self.assertTrue(init_security_mock.called)