Completed connection process of client and most of the main loops.