Implement poll(), unit tests