DuplexStream robustness improvements
Tests improvements