Add length limit to messages an automatically cut them accordingly

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Fix unclosed SSL socket (underlying TCP socket was been closed)

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>