Fixingfirewallconnectioncut 2

Fixes for the previous commits (about renewing connections before a firewall cuts them)
+ tests