• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ClientContainer类的典型用法和代码示例

java 2次浏览

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

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

示例1: run

点赞 3

import org.eclipse.jetty.websocket.jsr356.ClientContainer; //导入依赖的package包/类
protected static void run(final CountDownLatch latch) throws Exception {
    final Server server = new Server();
    final ServerConnector serverConnector = new ServerConnector(server);
    serverConnector.setPort(PORT);
    server.addConnector(serverConnector);
    final ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
    contextHandler.setContextPath("/");
    server.setHandler(contextHandler);
    WebSocketServerContainerInitializer.configureContext(contextHandler).addEndpoint(serverEndpointConfig());
    server.start();
    final ClientContainer container = new ClientContainer();
    container.start();
    connect(container, latch);
    container.stop();
    server.stop();
}
 

开发者ID:softappeal,
项目名称:yass,
代码行数:17,
代码来源:JettyTest.java

示例2: main

点赞 2

import org.eclipse.jetty.websocket.jsr356.ClientContainer; //导入依赖的package包/类
public static void main(final String... args) throws Exception {
    final DeploymentManager deployment = Servlets.defaultContainer()
        .addDeployment(
            Servlets.deployment()
                .setClassLoader(AsyncWsConnectionTest.class.getClassLoader())
                .setContextPath("/")
                .setDeploymentName(AsyncWsConnectionTest.class.getName())
                .addServletContextAttribute(
                    WebSocketDeploymentInfo.ATTRIBUTE_NAME,
                    new WebSocketDeploymentInfo()
                        .addEndpoint(serverEndpointConfig())
                        .setWorker(Xnio.getInstance().createWorker(OptionMap.builder().getMap()))
                        .setBuffers(new XnioByteBufferPool(new ByteBufferSlicePool(1024, 10240)))
                )
        );
    deployment.deploy();
    Undertow.builder()
        .addHttpListener(PORT, HOST)
        .setHandler(deployment.start())
        .build()
        .start();
    TimeUnit.SECONDS.sleep(1);
    if (true) {
        client(new ServerWebSocketContainer(
            DefaultClassIntrospector.INSTANCE,
            Xnio.getInstance().createWorker(OptionMap.create(Options.THREAD_DAEMON, true)),
            new XnioByteBufferPool(new ByteBufferSlicePool(1024, 10240)),
            List.of(new ContextClassLoaderSetupAction(ClassLoader.getSystemClassLoader())),
            true,
            true
        ));
    } else {
        final ClientContainer container = new ClientContainer(); // $note: setSendTimeout not yet implemented in Jetty
        container.start();
        client(container);
    }
}
 

开发者ID:softappeal,
项目名称:yass,
代码行数:38,
代码来源:AsyncWsConnectionTest.java

示例3: close

点赞 2

import org.eclipse.jetty.websocket.jsr356.ClientContainer; //导入依赖的package包/类
@Override
public void close() {
    try {
        session.close();
        if (container instanceof ClientContainer) {
            ((ClientContainer) container).stop();
        }
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
 

开发者ID:52North,
项目名称:matlab-connector,
代码行数:12,
代码来源:RemoteMatlabClient.java

示例4: getSslContainer

点赞 2

import org.eclipse.jetty.websocket.jsr356.ClientContainer; //导入依赖的package包/类
@Override
public WebSocketContainer getSslContainer(Properties config) {
    
    // With jetty, can't directly use ContainerProvider.getWebSocketContainer()
    // as it's "too late" to inject SslContextFactory into the mix.
    
    String trustStore = config.getProperty("ws.trustStore", 
                            System.getProperty("javax.net.ssl.trustStore"));
    String trustStorePassword = config.getProperty("ws.trustStorePassword",
                            System.getProperty("javax.net.ssl.trustStorePassword"));
    String keyStore = config.getProperty("ws.keyStore", 
                            System.getProperty("javax.net.ssl.keyStore"));
    String keyStorePassword = config.getProperty("ws.keyStorePassword", 
                            System.getProperty("javax.net.ssl.keyStorePassword"));
    String keyPassword = config.getProperty("ws.keyPassword", keyStorePassword);
    String certAlias = config.getProperty("ws.keyCertificateAlias", "default");
    
    // create ClientContainer as usual
    ClientContainer container = new ClientContainer();
    
    //  tweak before starting it
    SslContextFactory scf = container.getClient().getSslContextFactory();
    if (trustStore != null) {
        // System.out.println("setting " + trustStore);
        scf.setTrustStorePath(trustStore);
        scf.setTrustStorePassword(trustStorePassword);
    }
    if (keyStore != null) {
        // System.out.println("setting " + keyStore);
        scf.setKeyStorePath(keyStore);
        scf.setKeyStorePassword(keyStorePassword);
        scf.setKeyManagerPassword(keyPassword);
        scf.setCertAlias(certAlias);
    }
    
    // start as usual
    try {
        container.start();
        return container;
    }
    catch (Exception e)
    {
        throw new RuntimeException("Unable to start Client Container", e);
    }
}
 

开发者ID:quarks-edge,
项目名称:quarks,
代码行数:46,
代码来源:QuarksSslContainerProviderImpl.java

示例5: main

点赞 2

import org.eclipse.jetty.websocket.jsr356.ClientContainer; //导入依赖的package包/类
public static void main(final String... args) throws Exception {
    final ClientContainer container = new ClientContainer();
    container.start();
    Client.run(container);
}
 

开发者ID:softappeal,
项目名称:yass,
代码行数:6,
代码来源:JettyClient.java

示例6: main

点赞 2

import org.eclipse.jetty.websocket.jsr356.ClientContainer; //导入依赖的package包/类
public static void main(final String... args) throws Exception {
    final ClientContainer container = new ClientContainer();
    container.start();
    run(container);
}
 

开发者ID:softappeal,
项目名称:yass,
代码行数:6,
代码来源:JettyInitiator.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)