Search in sources :

Example 51 with ServiceDiscoveryManager

use of org.jivesoftware.smackx.disco.ServiceDiscoveryManager in project Smack by igniterealtime.

the class Socks5ByteStreamManagerTest method shouldDisableService.

/**
 * The SOCKS5 Bytestream feature should be removed form the service discovery manager if Socks5
 * bytestream feature is disabled.
 *
 * @throws InterruptedException if the calling thread was interrupted.
 * @throws SmackException if Smack detected an exceptional situation.
 * @throws XMPPErrorException if there was an XMPP error returned.
 */
@Test
public void shouldDisableService() throws XMPPErrorException, SmackException, InterruptedException {
    final Protocol protocol = new Protocol();
    final XMPPConnection connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
    Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
    ServiceDiscoveryManager discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
    assertTrue(discoveryManager.includesFeature(Bytestream.NAMESPACE));
    byteStreamManager.disableService();
    assertFalse(discoveryManager.includesFeature(Bytestream.NAMESPACE));
}
Also used : XMPPConnection(org.jivesoftware.smack.XMPPConnection) Protocol(org.jivesoftware.util.Protocol) ServiceDiscoveryManager(org.jivesoftware.smackx.disco.ServiceDiscoveryManager) Test(org.junit.jupiter.api.Test)

Aggregations

ServiceDiscoveryManager (org.jivesoftware.smackx.disco.ServiceDiscoveryManager)51 XMPPException (org.jivesoftware.smack.XMPPException)17 DiscoverInfo (org.jivesoftware.smackx.disco.packet.DiscoverInfo)17 SmackException (org.jivesoftware.smack.SmackException)16 DiscoverItems (org.jivesoftware.smackx.disco.packet.DiscoverItems)12 XMPPConnection (org.jivesoftware.smack.XMPPConnection)8 AfterClass (org.igniterealtime.smack.inttest.annotations.AfterClass)7 DomainBareJid (org.jxmpp.jid.DomainBareJid)7 ArrayList (java.util.ArrayList)6 TimeoutException (java.util.concurrent.TimeoutException)6 AbstractSmackIntegrationTest (org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest)6 SmackIntegrationTestEnvironment (org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment)6 SmackIntegrationTest (org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest)6 IntegrationTestRosterUtil (org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil)6 SimpleResultSyncPoint (org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint)6 EntityCapabilitiesChangedListener (org.jivesoftware.smackx.disco.EntityCapabilitiesChangedListener)6 PepEventListener (org.jivesoftware.smackx.pep.PepEventListener)6 Assertions (org.junit.jupiter.api.Assertions)6 URI (java.net.URI)4 NotLoggedInException (org.jivesoftware.smack.SmackException.NotLoggedInException)4