I’m a software developer and I’m using some C++ library to access a database. I want to test some aspects related to the handling of timeouts and stuck connections. While I can mock certain stuff, I also want to test how the real application is going to handle “hangups”, i.e. situations where the connection is not “dead” but is not responding for a period of time, either.
So my question is: on a Linux machine, is it possible and if yes, how, to put a network connection into a state where a library that wants to connect to a server on the Internet (I can set up the program to use a local IP as well) will not immediately “figure out” that there’s no Internet connectivity, but will remain stuck for a (ideally long, in the order of seconds or longer) while?