Moves the connection mechanism to the onConnect method