A man carried out a plan to have sex with a teenage boy he met on an online chat forum, a court heard.