Remove use of deprecated DuplexStream