add channel support.

This change add the support for sync and buffered channels.