Beispiel #1
0
        public HeartbeatExtension(byte mode)
        {
            if (!HeartbeatMode.IsValid(mode))
            {
                throw new ArgumentException("not a valid HeartbeatMode value", "mode");
            }

            this.mMode = mode;
        }
Beispiel #2
0
        /**
         * Parse a {@link HeartbeatExtension} from a {@link Stream}.
         *
         * @param input
         *            the {@link Stream} to parse from.
         * @return a {@link HeartbeatExtension} object.
         * @throws IOException
         */
        public static HeartbeatExtension Parse(Stream input)
        {
            byte mode = TlsUtilities.ReadUint8(input);

            if (!HeartbeatMode.IsValid(mode))
            {
                throw new TlsFatalAlert(AlertDescription.illegal_parameter);
            }

            return(new HeartbeatExtension(mode));
        }