Ejemplo n.º 1
0
 def testOpenRaisesNetworkExceptionOnAlreadyOpenConnection(self):
     context = ssl.SSLContext(ssl.PROTOCOL_TLS)
     mysocket = context.wrap_socket(
         socket(AF_INET, SOCK_STREAM),
         server_hostname=self.config["server"]["hostname"])
     con = Connection(self.config["server"]["ip"],
                      self.config["server"]["port"], mysocket)
     with self.assertRaises(NetworkException):
         con.open()
Ejemplo n.º 2
0
 def testA(self):
     """Note that all test method names must begin with 'test.'"""
     con = Connection("127.0.0.1", 10000)
     con.open()
     con.send("Can you hear me?")
     con.close()
     con.open()
     con.send("Can you hear me now?")
     con.close()
     assert 5 == 5, "bar() not calculating values correctly"