Take the 2-minute tour ×

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!

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

you can leverage your knowledge in Java writing simple unit tests that emulates random client behaviour:

  • too many data
  • too many connections
  • open and close
  • other corner cases

Pure Java tests, without native code and other tricky configuration are a huge win.

As starting point I recommend JMeter:


Take also a look at JUnitPerf website.

share|improve this answer
add comment

I'd suggest looking at netcat. It gives you a very flexible way of pushing all kinds of data to a running server.

share|improve this answer
And it is available for almost any system. –  aperkins Jul 28 '09 at 17:58
add comment

Richard Steven's Unix Network Programming (http://www.kohala.com/start/unpv12e.html) or TCP/IP Illustrated (same site) are a must for anyone doing low-level sockets programming. Everything is in C, but the concepts are transportable.

share|improve this answer
add comment

Your Answer


