private static int ReadByte(Stream stream) { var b = stream.ReadByte(); if (b == -1) throw new SshException("Stream has been closed."); return b; }