I'm developing internal messaging protocol that is based on TCP. Everything works, but I want to add tests to it.
It is possible to test serialization/deserialization with MemoryStream
, but I can't find a way to test this thing as whole - with contiguous message interchange, because MemoryStream
"ends" after reading first message.
The question: Is there a stream that behaves like NetworkStream
(duplex, ends only when other end closed, can't seek) in base library or any nuget package?
Currently I can start 2 TcpClient
s and use them, but I think it have too much overhead for tests especially when there's hundreds of tests running simultaneously
This is what I've been looking for Nerdbank.Streams.FullDuplexStream