flush
Flushes any queued messages to the client, if any exist. The flushing process takes place in the netty event loop, thus the calls to this function are non-blocking and fast. If not all packets were written due to writability constraints, this function will further be re-triggered when channel writability turns back to true, meaning this function can be called directly from the netty event loop, thus the check inside it.