Chained certificates support

Added some testing such that the original single certificate behaviour is maintained now that the code supports chained certificates. Took the opportunity to inline a bunch of code in the tests (and AbstractNeoServer) too.