Refactoring long polling transport to be able to fix bug #3227

Why are we null checking `initializeHandler` but not `connection`?