add a state attribute to Channel and refactor tests a bit