[FLINK-998] Close TCP connections after destroying logical channels

This commit introduces reference-counting to keep track of the InputChannel and OutputChannel instances, which share the same physical TCP connection. This is basically a backport from #254.

When the logical channels are released in the channel manager, the reference count will reach 0 and the respective TCP connection can safely be closed.

Furthermore, the debug thread in the OutboundConnectionQueue is properly shut down and all queued buffers are freed when the channel is closed or an Exception occurs.

I've tested it on a 4 node cluster with parallelism of 32 and the debug output thread showed that connections are closed successfully. I've also tested cancelling. It would be nice to review this thoroughly though. ;-)

PS: If everything is fine, we should definitely include this in the next release.
The test was doing a `getAndIncrement()` before... that's why.