A python script downloads files from an ftp server as it runs.
The process uses combat ftp, and I would not want to complicate the process of raising a virtual machine with a test ftp - the script's work is sensitive to the content and I will have to configure the data update.
It is necessary to test the behavior when the connection is broken during the download . It is advisable to do this automatically, that is, manually doing kill myftpserver or pulling the cord out of the network card is not an option.
Thus, I need to either terminate the current connection directly on the test server, or raise the proxy, wait for the connection on it and terminate in a second or two. I can not imagine how to implement it. You need at least the name of the utility or command, which I can catch the current connection and terminate it, or block all current connections to the specified ip.
Of course, I'm testing on a test instance. It has root access via ssh.