added connection-level flow control and tests