public static IStumpResponseFactory Nothing(this IStumpResponseFactory responseFactory)
        {
            responseFactory.Add(new TcpResponse
            {
                new TcpMessage()
            });

            return(responseFactory);
        }
        public static IStumpResponseFactory DropConnection(this IStumpResponseFactory responseFactory)
        {
            responseFactory.Add(new TcpResponse
            {
                new TcpMessage
                {
                    TerminateConnection = true
                }
            });

            return(responseFactory);
        }
Example #3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Stump" /> class.
        /// </summary>
        /// <param name="stumpId">The unique identifier for the stump.</param>
        /// <exception cref="ArgumentNullException"><paramref name="stumpId"/> is <c>null</c>, an empty string, or only contains white space.</exception>
        public Stump(string stumpId)
        {
            if (string.IsNullOrWhiteSpace(stumpId))
            {
                throw new ArgumentNullException(nameof(stumpId));
            }

            this.StumpId = stumpId;
            _ruleList    = new List <IStumpRule>();

            _responseFactory = new StumpResponseFactory();
        }
        public static IStumpResponseFactory TheDelayedMessage(this IStumpResponseFactory responseFactory, byte[] message, int delayTime)
        {
            responseFactory.Add(new TcpResponse
            {
                new TcpMessage
                {
                    Message       = message,
                    ResponseDelay = delayTime
                }
            });

            return(responseFactory);
        }
 public static TcpResponse MultipleMessages(this IStumpResponseFactory responseFactory)
 {
     return(responseFactory.Add(new TcpResponse()));
 }
 public static IStumpResponseFactory TheMessage(this IStumpResponseFactory responseFactory, byte[] message)
 {
     responseFactory.AddResponseMessage(message);
     return(responseFactory);
 }