Fix bugs in ZLIB codec where they produce malformed stream or their streams are not flushed on time

- Fixes #2014
- Add the tests that mix JDK ZLIB codec and JZlib codecs
- Fix a bug where JdkZlibEncoder does not encode the GZIP header when nothing was written to te channel
- Fix a bug where the encoders do not consider the overhead of the wrapper format when calculating the estimated compressed output size.
- Fix a bug where the decoders do not discard the received data after the compressed stream is finished
Remove the use of ThreadLocal for performance reasons
Merge remote-tracking branch: upstream/master