I expect that Yahoo! Messenger clients communicate with the Yahoo! Messenger server over http and https or ssl.
Assuming that you know what data to send to the Yahoo! Messenger server (and how to interpret the data that gets sent back) then you would need to use some of the following classes/interfaces in the javax.microedition.io package -