Get rid of ugly static_cast usages in connect() calls

Authored by elvisangelaccio on May 5 2019, 3:20 PM.