Look at
files ‘echo-server-test’, ‘echo-server-nb’, and ‘echo-server-threaded’. The first is a test that breaks on the basic ‘echo-server’; the second is a non-blocking implementation; and the third is a threaded implementation.
See these overly complicated explanations; the last one is probably the best:
http://en.wikipedia.org/wiki/Dependency_injection
http://msdn.microsoft.com/en-us/magazine/cc163739.aspx
http://jamesshore.com/Blog/Dependency-Injection-Demystified.html