Found during work on on fix for #2653
The Connection.Start method in the .NET client initializes instance state variables, e.g. _startTcs, before checking the state of the connection.
This means that if you call Start().Wait() twice in a row, the second call to Start will blast away the state of the connection, resulting in strange errors (as the internal state is now essentially in a corrupt state).
Ensure calling connection.Start() multi times is safe in .NET client:
- Don't initialize the connection state unless we're actually starting
- Added a unit test to verify calling Start() multiple times doesn't corrupt the connection
Ensure test uses new transport instance in each start call
ran test ConnectionFunctionsCorrectlyAfterCallingStartMutlipleTimes