How do they pass messages between them? what are the classes involved?
Do you understand what Smack and Openfire are?
Openfire is a XMPP based messaging server.
Smack is a XMPP client library.
XMPP is an XML based messaging standard so they pass XML back and forth.
So the question you’re asking is basically how do I use Smack which is answered in the Smack documentation.