made get_data() more robust in detecting a client close, and extended tests for all combinations of connection states and terminations