public void TestErrorRelay()
{
// Throw exception on producer thread after a short delay
new Thread(() =>
{
Thread.Sleep(50);
_stream.RelayErrorToReader(new InvalidDataException("Test exception"));
}).Start();
// Catch exception on consumer thread
_stream.Invoking(x => x.Read(2)).ShouldThrow <InvalidDataException>();
}