Fix a possible buffer overflow
Fix tests build on system without gnutls
Fix a warning in connect test