app.lua: Added selftest based on simple App design.

Tests driving 1,000 packets through this partly-looping topology:

		 .--------.
		 v        |
    source --> join --> split --> sink

The code is messy and needs cleaning up.