cleanup callback handling logic, add as err listener

errors on app.listen do not invoke the callback passed as a
parameter, but emit an 'error' event. So if a callback is
provided, add it as an error event listener.
update 6 tests for "cleanup callback handling logic"
rm unused var
Merge pull request #1150 from isao/onerrListener

cleanup callback handling logic, add as err listener