Reputation: 361
I have written an application that reads from and writes to a tcp socket.
Suppose the ethernet cable is unplugged after the application sends a message but before the TCP-level ACK
response. An exception will thrown in my application.
How can I test the exception handling without physically unplugging the cable?
I'm using an application-level protocol that does not implement acknowledgments of its own.
I'm on windows but am open to solutions involving linux as well.
Upvotes: 0
Views: 390
Reputation: 136266
Establish a TCP connection with a peer in a virtual machine, then kill the virtual machine with kill -KILL <pid>
. Check in Wireshark that killing the virtual machine doesn't cause it to emit RST
packet (because unplugging the cable doesn't).
Upvotes: 2