Add Longpoller integration tests and fix listener bug