Added a timer to measure the time taken during the connection process.