I am creating a non-blocking IO system for the server side of my project. The actual implementation isn't important (it is Java NIO if you care), but I feel very intimidated by the subtle issues you have to pay close attention to when programming socket communications. My knowledge is lacking in a lot of areas, so I can't even conceive of all the ways things can "go wrong"... "half-closed" connections, connections that send much more data than I would anticipate, etc.
What I am looking for is some sort of client-side tool to help test the robustness of my system by automating the process of connecting and testing for a specific behavior. Some sort of tool with different sorts of options to simulate the different ways in which connections could be open, used, and closed. Perhaps it would let me send a megabyte of gibberish at once, or try to do things that don't "make sense", all for the purposes of me being able to test random, rare things that might cause my code to break, or to fail to recognize a "broken" connection and close it.
Does a sort of tool exist? Another approach might be some Java code/unit test. Any thoughts? Thanks so much!