当前位置: 首页>>代码示例>>Java>>正文


Java Anonymous类代码示例

本文整理汇总了Java中org.apache.vysper.xmpp.authorization.Anonymous的典型用法代码示例。如果您正苦于以下问题:Java Anonymous类的具体用法?Java Anonymous怎么用?Java Anonymous使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Anonymous类属于org.apache.vysper.xmpp.authorization包,在下文中一共展示了Anonymous类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EmbeddedXMPPServer

import org.apache.vysper.xmpp.authorization.Anonymous; //导入依赖的package包/类
public EmbeddedXMPPServer(int port) throws Exception {

        StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
        AccountManagement accountManagement = (AccountManagement) providerRegistry.retrieve(AccountManagement.class);

        Entity consumer = EntityImpl.parseUnchecked("[email protected]");
        accountManagement.addUser(consumer, "secret");

        Entity producer = EntityImpl.parseUnchecked("[email protected]");
        accountManagement.addUser(producer, "secret");

        TCPEndpoint endpoint = new TCPEndpoint();
        endpoint.setPort(port);

        InputStream stream = EmbeddedXMPPServer.class.getResourceAsStream("/xmpp/server.jks");

        server = new XMPPServer("apache.camel");
        server.setStorageProviderRegistry(providerRegistry);
        server.addEndpoint(endpoint);
        server.setTLSCertificateInfo(stream, "secret");
        server.setSASLMechanisms(Arrays.asList(new SASLMechanism[]{new Anonymous()}));
    }
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:23,代码来源:EmbeddedXMPPServer.java

示例2: run

import org.apache.vysper.xmpp.authorization.Anonymous; //导入依赖的package包/类
@Override
public void run(String... args) throws Exception {

    xmppServer = new XMPPServer(domain);
    xmppServer.setStorageProviderRegistry(storageProviderRegistry);

    final TCPEndpoint endpoint = new TCPEndpoint();
    endpoint.setPort(xmppPort);
    xmppServer.addEndpoint(endpoint);

    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(keystore);
    xmppServer.setTLSCertificateInfo(is, keystorePassword);

    // allow anonymous authentication
    xmppServer.setSASLMechanisms(Arrays.asList(new SASLMechanism[]{new Anonymous()}));

    xmppServer.start();

    // add the multi-user chat module and create a room
    Conference conference = new Conference("Conference");
    conference.createRoom(EntityImpl.parseUnchecked("[email protected]" + domain), "Public Room", RoomType.Public);

    xmppServer.addModule(new MUCModule("conference", conference));
    xmppServer.addModule(new InBandRegistrationModule());
    xmppServer.addModule(new XmppPingModule());
    xmppServer.addModule(new PublishSubscribeModule());
    xmppServer.addModule(new SoftwareVersionModule());

    if (saveMessage) {
        // add MessageHandler
        HandlerDictionary handlerDictionary = new DefaultHandlerDictionary(myMessageHandler);
        ((DefaultServerRuntimeContext) xmppServer.getServerRuntimeContext()).addDictionary(handlerDictionary);
    }

    LOG.info("XMPP Server is running on port {}", xmppPort);
}
 
开发者ID:tumakha,项目名称:xmpp-light,代码行数:37,代码来源:XMPPServerRunner.java


注:本文中的org.apache.vysper.xmpp.authorization.Anonymous类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。