_next_connection() correctly returns undef when reading past the end