For functional testing of a client application, a web server is required that supports the simulation of various failures, for example, slowing down the rate of content delivery, communication breaks, etc.

Now two approaches are used - using clumsy- like utilities , which cause failures at the network adapter level, and manual removal of the flask web server process (to simulate a disconnection).

These methods do not always allow deterministic, according to the scenario, to introduce certain failures. For example, one of the planned test scenarios is to terminate the connection after the server sends the n-th number of bytes.

From visible solutions - to write your web server, taking for example mongoose as a basis.

But since the problem is quite common, perhaps there are ready-made solutions. Tell me which way to dig.

    1 answer 1

    I would use this http://www.haka-security.org/ or proxy server / script.

    I do not think that it will be difficult for you to build a proxy script that forwards connections, breaks them when needed, or returns the error you need, sleeps from time to time (or according to your test settings - for determinism), and in any case, this simpler and more reliable than a custom web server