Add SOCKS flag to constants.
Refactor connection procedure of client application.