Examples of ServiceDiscoveryManager


Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

            return false;
        }

        LOGGER.debug("Service listing");

        ServiceDiscoveryManager disco = ServiceDiscoveryManager
                .getInstanceFor(connection);
        try {
            DiscoverItems items = disco.discoverItems(connection.getServiceName());

            Iterator iter = items.getItems();
            while (iter.hasNext()) {
                DiscoverItems.Item item = (DiscoverItems.Item) iter.next();
                DiscoverInfo info = disco.discoverInfo(item.getEntityID());

                Iterator<DiscoverInfo.Identity> iter2 = info.getIdentities();
                while (iter2.hasNext()) {
                    DiscoverInfo.Identity identity = iter2.next();
                    if (identity.getCategory().equals("proxy") && identity.getType().equals("stun"))
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

                    if (connection != connection2) {
                        // Ignore the connections created in createAccount.
                        return;
                    }

                    ServiceDiscoveryManager sdm = ServiceDiscoveryManager
                        .getInstanceFor(connection);
                    sdm.addFeature(Saros.NAMESPACE);

                    setBytestreamConnectionProperties();
                }
            });
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

        /*
         * create service discovery managers for the connections because the
         * ConnectionCreationListener is not called when creating mocked connections
         */
        new ServiceDiscoveryManager(connection1);
        new ServiceDiscoveryManager(connection2);

        // get bytestream manager for the first connection twice
        Socks5BytestreamManager conn1ByteStreamManager1 = Socks5BytestreamManager.getBytestreamManager(connection1);
        Socks5BytestreamManager conn1ByteStreamManager2 = Socks5BytestreamManager.getBytestreamManager(connection1);

View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * bytestream feature is disabled.
     */
    @Test
    public void shouldDisableService() {
        Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
        ServiceDiscoveryManager discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);

        assertTrue(discoveryManager.includesFeature(Socks5BytestreamManager.NAMESPACE));

        byteStreamManager.disableService();

        assertFalse(discoveryManager.includesFeature(Socks5BytestreamManager.NAMESPACE));
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

  //Connection.DEBUG_ENABLED = true;

  connection = new DummyConnection();
  connection.connect();
  connection.login("me", "secret");
  new ServiceDiscoveryManager(connection);
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

            return false;
        }

        LOGGER.debug("Service listing");

        ServiceDiscoveryManager disco = ServiceDiscoveryManager
                .getInstanceFor(connection);
        try {
//            DiscoverItems items = disco.discoverItems(connection.getServiceName());
//            Iterator iter = items.getItems();
//            while (iter.hasNext()) {
//                DiscoverItems.Item item = (DiscoverItems.Item) iter.next();
//                if (item.getEntityID().startsWith("rtpbridge.")) {
//                    return true;
//                }
//            }
           
            DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName());
            Iterator iter = discoInfo.getIdentities();
            while (iter.hasNext()) {
                DiscoverInfo.Identity identity = (DiscoverInfo.Identity) iter.next();
                if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {
          return true;
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

    public static boolean isJIDonServer(Connection connection, JID jid,
        SubMonitor monitor) throws XMPPException {
        if (monitor != null)
            monitor.beginTask("Performing Service Discovery on JID " + jid, 2);

        ServiceDiscoveryManager sdm = ServiceDiscoveryManager
            .getInstanceFor(connection);

        if (monitor != null) {
            monitor.worked(1);
            if (monitor.isCanceled())
                throw new CancellationException();
        }

        try {
            boolean discovered = sdm.discoverInfo(jid.getRAW()).getIdentities()
                .hasNext();

            if (!discovered && jid.isBareJID()) // FIXME: removed the hard coded
                                                // suffix
                discovered = sdm.discoverInfo(jid.getRAW() + "/Saros")
                    .getIdentities().hasNext();

            /*
             * discovery does not change any state, if the user wanted to cancel
             * it, we can do that even after the execution finished
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

                new StackTrace());

        if (!sarosNet.isConnected())
            throw new IllegalStateException("Not Connected");

        ServiceDiscoveryManager sdm = ServiceDiscoveryManager
            .getInstanceFor(sarosNet.getConnection());

        try {
            return sdm.discoverInfo(recipient.toString());
        } catch (XMPPException e) {

            log.warn(
                "Service Discovery failed on recipient " + recipient.toString()
                    + " server:" + sarosNet.getConnection().getHost() + ":", e);
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     * @param connection The connection on which to enable or disable the services.
     * @param isEnabled  True to enable, false to disable.
     */
    public static void setServiceEnabled(final Connection connection,
            final boolean isEnabled) {
        ServiceDiscoveryManager manager = ServiceDiscoveryManager
                .getInstanceFor(connection);

        List<String> namespaces = new ArrayList<String>();
        namespaces.addAll(Arrays.asList(NAMESPACE));
        namespaces.add(InBandBytestreamManager.NAMESPACE);
        if (!IBB_ONLY) {
            namespaces.add(Socks5BytestreamManager.NAMESPACE);
        }

        for (String namespace : namespaces) {
            if (isEnabled) {
                if (!manager.includesFeature(namespace)) {
                    manager.addFeature(namespace);
                }
            } else {
                manager.removeFeature(namespace);
            }
        }
       
    }
View Full Code Here

Examples of org.jivesoftware.smackx.ServiceDiscoveryManager

     *
     * @param connection The connection to check
     * @return True if all related services are enabled, false if they are not.
     */
    public static boolean isServiceEnabled(final Connection connection) {
        ServiceDiscoveryManager manager = ServiceDiscoveryManager
                .getInstanceFor(connection);

        List<String> namespaces = new ArrayList<String>();
        namespaces.addAll(Arrays.asList(NAMESPACE));
        namespaces.add(InBandBytestreamManager.NAMESPACE);
        if (!IBB_ONLY) {
            namespaces.add(Socks5BytestreamManager.NAMESPACE);
        }

        for (String namespace : namespaces) {
            if (!manager.includesFeature(namespace)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.