InBandRegistrationTest.java (1200B)
1 package eu.siacs.compliance.tests; 2 3 import eu.siacs.compliance.Result; 4 import rocks.xmpp.core.XmppException; 5 import rocks.xmpp.core.session.XmppClient; 6 import rocks.xmpp.extensions.register.RegistrationManager; 7 import rocks.xmpp.extensions.register.model.Registration; 8 9 import java.util.concurrent.ExecutionException; 10 11 public class InBandRegistrationTest extends AbstractTest { 12 13 public InBandRegistrationTest(XmppClient client) { 14 super(client); 15 } 16 17 @Override 18 public Result run() { 19 final String domain = client.getConnectedResource().getDomain(); 20 final XmppClient testClient = XmppClient.create(domain); 21 try { 22 testClient.connect(); 23 RegistrationManager registrationManager = testClient.getManager(RegistrationManager.class); 24 if(registrationManager.isRegistrationSupported().getResult()) { 25 registrationManager.getRegistration().get(); 26 return Result.PASSED; 27 } 28 return Result.FAILED; 29 } catch (Exception e) { 30 return Result.FAILED; 31 } 32 } 33 34 @Override 35 public String getName() { 36 return "XEP-0077: In-Band Registration"; 37 } 38 }