Esempio n. 1
0
        public static void CheckEmptyFrameSize()
        {
            var f = new EmptyOutboundFrame();

            byte[] b = new byte[f.GetMinimumBufferSize()];
            f.WriteTo(b);
            long actualLength = f.ByteCount;

            if (EmptyFrameSize != actualLength)
            {
                string message =
                    string.Format("EmptyFrameSize is incorrect - defined as {0} where the computed value is in fact {1}.",
                                  EmptyFrameSize,
                                  actualLength);
                throw new ProtocolViolationException(message);
            }
        }
Esempio n. 2
0
        public static void CheckEmptyFrameSize()
        {
            var f      = new EmptyOutboundFrame();
            var stream = new MemoryStream();
            var writer = new NetworkBinaryWriter(stream);

            f.WriteTo(writer);
            long actualLength = stream.Length;

            if (EmptyFrameSize != actualLength)
            {
                string message =
                    string.Format("EmptyFrameSize is incorrect - defined as {0} where the computed value is in fact {1}.",
                                  EmptyFrameSize,
                                  actualLength);
                throw new ProtocolViolationException(message);
            }
        }