Package org.eclipse.jetty.websocket.jsr356

Examples of org.eclipse.jetty.websocket.jsr356.EndpointEchoClient


        // Create Local JsrSession
        String id = testname.getMethodName();
        URI requestURI = URI.create("ws://localhost/" + id);
        DummyConnection connection = new DummyConnection();
        ClientContainer container = new ClientContainer();
        @SuppressWarnings("resource")
        JsrSession session = new JsrSession(requestURI,driver,connection,container,id);
        session.setPolicy(policy);
        session.open();
        return driver;
View Full Code Here


            {
                this.decoder = decoderClass.newInstance();
            }
            catch (InstantiationException | IllegalAccessException e)
            {
                throw new InitException("Unable to create decoder: " + decoderClass.getName(),e);
            }
        }
    }
View Full Code Here

    public void testDeflateFrameExtension() throws Exception
    {
        Assume.assumeTrue("Server has deflate-frame extension registered",serverExtensionFactory.isAvailable("deflate-frame"));
       
        ClientEndpointConfig config = ClientEndpointConfig.Builder.create()
                .extensions(Arrays.<Extension>asList(new JsrExtension("deflate-frame")))
                .build();

        final String content = "deflate_me";
        final CountDownLatch messageLatch = new CountDownLatch(1);
        URI uri = URI.create("ws://localhost:" + connector.getLocalPort());
View Full Code Here

    public void testPerMessageDeflateExtension() throws Exception
    {
        Assume.assumeTrue("Server has permessage-deflate extension registered",serverExtensionFactory.isAvailable("permessage-deflate"));
       
        ClientEndpointConfig config = ClientEndpointConfig.Builder.create()
                .extensions(Arrays.<Extension>asList(new JsrExtension("permessage-deflate")))
                .build();

        final String content = "deflate_me";
        final CountDownLatch messageLatch = new CountDownLatch(1);
        URI uri = URI.create("ws://localhost:" + connector.getLocalPort());
View Full Code Here

        // deal with extensions
        List<Extension> installedExts = new ArrayList<>();
        for (String extName : extensionFactory.getAvailableExtensions().keySet())
        {
            installedExts.add(new JsrExtension(extName));
        }
        List<Extension> requestedExts = new ArrayList<>();
        for (ExtensionConfig reqCfg : req.getExtensions())
        {
            requestedExts.add(new JsrExtension(reqCfg));
        }
        List<Extension> usedExts = configurator.getNegotiatedExtensions(installedExts,requestedExts);
        List<ExtensionConfig> configs = new ArrayList<>();
        if (usedExts != null)
        {
View Full Code Here

        super(copy);
    }

    public Object call(Object endpoint, ByteBuffer buf) throws DecodeException
    {
        super.args[idxMessageObject] = new JsrPongMessage(buf);
        return super.call(endpoint,super.args);
    }
View Full Code Here

            BufferUtil.flipToFlush(pongBuf,0);
        }

        @SuppressWarnings("unchecked")
        Whole<PongMessage> pongHandler = (Whole<PongMessage>)wrapper.getHandler();
        pongHandler.onMessage(new JsrPongMessage(pongBuf));
    }
View Full Code Here

        // Create Local JsrSession
        String id = testname.getMethodName();
        URI requestURI = URI.create("ws://localhost/" + id);
        DummyConnection connection = new DummyConnection();
        ClientContainer container = new ClientContainer();
        @SuppressWarnings("resource")
        JsrSession session = new JsrSession(requestURI,driver,connection,container,id);
        session.setPolicy(policy);
        session.open();
        return driver;
    }
View Full Code Here

        this.mappedCreator = creator;
        this.webSocketServerFactory = factory;
        EventDriverFactory eventDriverFactory = this.webSocketServerFactory.getEventDriverFactory();
        eventDriverFactory.addImplementation(new JsrServerEndpointImpl());
        eventDriverFactory.addImplementation(new JsrServerExtendsEndpointImpl());
        this.webSocketServerFactory.addSessionFactory(new JsrSessionFactory(this,this));
    }
View Full Code Here

    @Override
    public void onBinaryFrame(ByteBuffer buffer, boolean fin) throws IOException
    {
        if (activeMessage == null)
        {
            final MessageHandlerWrapper wrapper = jsrsession.getMessageHandlerWrapper(MessageType.BINARY);
            if (wrapper == null)
            {
                if (LOG.isDebugEnabled())
                {
                    LOG.debug("No BINARY MessageHandler declared");
                }
                return;
            }
            if (wrapper.wantsPartialMessages())
            {
                activeMessage = new BinaryPartialMessage(wrapper);
            }
            else if (wrapper.wantsStreams())
            {
                final MessageInputStream stream = new MessageInputStream();
                activeMessage = stream;
                dispatch(new Runnable()
                {
                    @SuppressWarnings("unchecked")
                    @Override
                    public void run()
                    {
                        MessageHandler.Whole<InputStream> handler = (Whole<InputStream>)wrapper.getHandler();
                        handler.onMessage(stream);
                    }
                });
            }
            else
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.jsr356.EndpointEchoClient

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.