Hi,
I started using Smack following the documentation.
I want to connect like in the doc :
ConnectionConfiguration config = new ConnectionConfiguration("jabber.org", 5222);
Connection conn2 = new XMPPConnection(config);
conn2.connect();
But XMPPConnection is abstract.
I created myConnection class.
class myConnection extends XMPPConnection{ public myConnection(ConnectionConfiguration configuration) { super(configuration); } @Override public String getUser() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public String getConnectionID() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicboolean isConnected() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicboolean isAuthenticated() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicboolean isAnonymous() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicboolean isSecureConnection() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override protectedvoid sendPacketInternal(Packet packet) throws SmackException.NotConnectedException { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicboolean isUsingCompression() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override protectedvoid connectInternal() throws SmackException, IOException, XMPPException { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicvoid login(String string, String string1, String string2) throws XMPPException, SmackException, SaslException, IOException { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override publicvoid loginAnonymously() throws XMPPException, SmackException, SaslException, IOException { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override protectedvoid shutdown() { thrownew UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
Then try :
ConnectionConfiguration config = new ConnectionConfiguration("192.168.93.139", 5222); myConnection conn = new myConnection(config); conn.connect();
But JAVA send me an error message :
Exception in thread "main" java.lang.UnsupportedOperationException: Not supported yet.
at javaapplication2.myConnection.connectInternal(myConnection.java:71)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:391)
at javaapplication2.JavaApplication2.main(JavaApplication2.java:40)
Java Result: 1
Thx for your help.