/// <summary>
        /// Instantiates.
        /// </summary>
        /// <param name="encoding">the <see cref="Encoding"/></param>
        /// <param name="delimiter">the <see cref="LineDelimiter"/></param>
        public TextLineDecoder(Encoding encoding, LineDelimiter delimiter)
        {
            if (encoding == null)
                throw new ArgumentNullException("encoding");
            if (delimiter == null)
                throw new ArgumentNullException("delimiter");

            CONTEXT = new AttributeKey(GetType(), "context");
            _encoding = encoding;
            _delimiter = delimiter;

            _delimBuf = encoding.GetBytes(delimiter.Value);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="messageFactory">the factory to generate keep-alive messages</param>
        /// <param name="interestedIdleStatus"></param>
        /// <param name="strategy"></param>
        /// <param name="keepAliveRequestInterval">the interval to send a keep-alive request</param>
        /// <param name="keepAliveRequestTimeout">the time to wait for a keep-alive response before timed out</param>
        public KeepAliveFilter(IKeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus,
            IKeepAliveRequestTimeoutHandler strategy, Int32 keepAliveRequestInterval, Int32 keepAliveRequestTimeout)
        {
            if (messageFactory == null)
                throw new ArgumentNullException("messageFactory");
            if (strategy == null)
                throw new ArgumentNullException("strategy");

            WAITING_FOR_RESPONSE = new AttributeKey(GetType(), "waitingForResponse");
            IGNORE_READER_IDLE_ONCE = new AttributeKey(GetType(), "ignoreReaderIdleOnce");
            _messageFactory = messageFactory;
            _interestedIdleStatus = interestedIdleStatus;
            _requestTimeoutHandler = strategy;
            RequestInterval = keepAliveRequestInterval;
            RequestTimeout = keepAliveRequestTimeout;
        }