csharp: Check connection state in calls
java: Check connection state in calls

Throws exception on mismatch.