This code already exists in system_tests_tcp_adaptor. It just needs to be moved to the system_tests file.