Fix tunnel chunking, add tests.