def setUpClass(self): self.tcp = bof.TCP() self.echo_server = Popen(TCP_ECHO_SERVER_CMD.split()) sleep(0.5) # Waiting for TCP handshake
def test_0304_tcp_connect_bad_port(self): """Test error handling for bad port.""" tcp = bof.TCP() with self.assertRaises(bof.BOFNetworkError): tcp.connect("localhost", 666666)
def test_0302_tcp_connect(self): """Test regular TCP connection.""" tcp = bof.TCP() tcp.connect("localhost", 23671) self.assertEqual(tcp.source[0], '127.0.0.1') tcp.disconnect()
def test_0303_tcp_connect_bad_addr(self): """Test error handling for bad address.""" tcp = bof.TCP() with self.assertRaises(bof.BOFNetworkError): tcp.connect("invalid", 23671)
def test_0301_tcp_instantiate(self): """Test correct BOF TCP object instantiation.""" tcp = bof.TCP()