Issue #767 Fix TcpOutput test hang

The output was being shutdown after the message was queued but
before it was sent causing the test to wait forever for the result.