Add command handling.
Add flush method to connection class.