Package org.eclipse.jetty.websocket.client

Examples of org.eclipse.jetty.websocket.client.WebSocketClient


                httpClient.addBean(wsClientContainer, true);
                break;
            case WEBSOCKET_JETTY:
                wsThreadPool = new QueuedThreadPool();
                wsThreadPool.setName(wsThreadPool.getName() + "-client");
                wsClient = new WebSocketClient();
                wsClient.setExecutor(wsThreadPool);
                httpClient.addBean(wsClient);
                break;
            default:
                throw new IllegalArgumentException();
View Full Code Here


    }

    public void start() throws Exception
    {
        threadPool = new QueuedThreadPool();
        wsClient = new WebSocketClient();
        wsClient.setExecutor(threadPool);
        wsClient.setMasker(new ZeroMasker());
        wsClient.start();
    }
View Full Code Here

        webSocketContainer = ContainerProvider.getWebSocketContainer();
        // Make sure the container is stopped when the HttpClient is stopped
        httpClient.addBean(webSocketContainer, true);
        mbeanContainer.beanAdded(null, webSocketContainer);

        webSocketClient = new WebSocketClient();
        webSocketClient.setExecutor(threadPool);
        webSocketClient.setMasker(new ZeroMasker());
        webSocketClient.getPolicy().setInputBufferSize(8 * 1024);
        webSocketClient.addBean(mbeanContainer);
        webSocketClient.start();
View Full Code Here

        decoderFactory.init(empty);
        encoderFactory.init(empty);

        boolean trustAll = Boolean.getBoolean("org.eclipse.jetty.websocket.jsr356.ssl-trust-all");
       
        client = new WebSocketClient(new SslContextFactory(trustAll), executor);
        client.setEventDriverFactory(new JsrEventDriverFactory(client.getPolicy()));
        client.setSessionFactory(new JsrSessionFactory(this,this,client));
        addBean(client);

        ShutdownThread.register(this);
View Full Code Here

        return engine;
    }

    public UpgradeConnection newUpgradeConnection(SocketChannel channel, EndPoint endPoint, ConnectPromise connectPromise)
    {
        WebSocketClient client = connectPromise.getClient();
        Executor executor = client.getExecutor();
        UpgradeConnection connection = new UpgradeConnection(endPoint,executor,connectPromise);
        return connection;
    }
View Full Code Here

    private ServiceSocket getConnectionSocket() throws URISyntaxException, Exception {
        URI uri = getUri();

        String connectionId = getThreadName() + getConnectionId();
        ServiceSocket socket;
        WebSocketClient webSocketClient;
        if (isStreamingConnection()) {
             if (connectionList.containsKey(connectionId)) {
                 socket = connectionList.get(connectionId);
                 socket.initialize();
                 return socket;
             } else {
                socket = new ServiceSocket(this);
                connectionList.put(connectionId, socket);
             }
        } else {
            socket = new ServiceSocket(this);
        }

        SslContextFactory sslContexFactory = new SslContextFactory();
        sslContexFactory.setTrustAll(isIgnoreSslErrors());
        webSocketClient = new WebSocketClient(sslContexFactory);
       
        webSocketClient.start();
        ClientUpgradeRequest request = new ClientUpgradeRequest();
        webSocketClient.connect(socket, uri, request);
       
        int connectionTimeout = Integer.parseInt(getConnectionTimeout());
        socket.awaitOpen(connectionTimeout, TimeUnit.MILLISECONDS);
       
        return socket;
View Full Code Here

        ServiceSocket socket;

        //Create WebSocket client
        SslContextFactory sslContexFactory = new SslContextFactory();
        sslContexFactory.setTrustAll(isIgnoreSslErrors());
        WebSocketClient webSocketClient = new WebSocketClient(sslContexFactory);       
       
        if (isStreamingConnection()) {
             if (connectionList.containsKey(connectionId)) {
                 socket = connectionList.get(connectionId);
                 socket.initialize();
                 return socket;
             } else {
                socket = new ServiceSocket(this, webSocketClient);
                connectionList.put(connectionId, socket);
             }
        } else {
            socket = new ServiceSocket(this, webSocketClient);
        }

        //Start WebSocket client thread and upgrage HTTP connection
        webSocketClient.start();
        ClientUpgradeRequest request = new ClientUpgradeRequest();
        webSocketClient.connect(socket, uri, request);
       
        //Get connection timeout or use the default value
        int connectionTimeout;
        try {
            connectionTimeout = Integer.parseInt(getConnectionTimeout());
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.client.WebSocketClient

Copyright © 2018 www.massapicom. 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.