Smack (Java)
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.chat.Chat;
import org.jivesoftware.smack.chat.ChatManager;
import org.jivesoftware.smack.chat.ChatMessageListener;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
public void sendMessage() {
XMPPTCPConnectionConfiguration config =
XMPPTCPConnectionConfiguration.builder()
.setServiceName("mydomain.local")
.setHost("127.0.0.1")
.setPort(5222)
.build();
XMPPTCPConnection connection = new XMPPTCPConnection(config);
connection.connect();
connection.login("test1", "test1pwd");
ChatManager chatManager = ChatManager.getInstanceFor(connection);
String test2JID = "[email protected]";
Chat chat = chatManager.createChat(test2JID);
chat.sendMessage("Hello, how are you?");
connection.disconnect();
}