Package org.eclipse.jetty.websocket.jsr356.client

Examples of org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata


        this.webSocketServerFactory.addSessionFactory(new JsrSessionFactory(this,this));
    }
   
    public EndpointInstance newClientEndpointInstance(Object endpoint, ServerEndpointConfig config, String path)
    {
        EndpointMetadata metadata = getClientEndpointMetadata(endpoint.getClass(),config);
        ServerEndpointConfig cec = config;
        if (config == null)
        {
            if (metadata instanceof AnnotatedServerEndpointMetadata)
            {
View Full Code Here


        return client;
    }

    public EndpointMetadata getClientEndpointMetadata(Class<?> endpoint, EndpointConfig config)
    {
        EndpointMetadata metadata = null;

        synchronized (endpointClientMetadataCache)
        {
            metadata = endpointClientMetadataCache.get(endpoint);
View Full Code Here

        }
    }

    public EndpointInstance newClientEndpointInstance(Object endpoint, ClientEndpointConfig config)
    {
        EndpointMetadata metadata = getClientEndpointMetadata(endpoint.getClass(),config);
        ClientEndpointConfig cec = config;
        if (config == null)
        {
            if (metadata instanceof AnnotatedClientEndpointMetadata)
            {
View Full Code Here

            Class<?> onMessageClass = ReflectUtils.findGenericClassFor(handler,MessageHandler.Partial.class);
            if (LOG.isDebugEnabled())
            {
                LOG.debug("Partial message class: {}",onMessageClass);
            }
            metadatas.add(new MessageHandlerMetadata(handler,onMessageClass,partial));
        }

        if (MessageHandler.Whole.class.isAssignableFrom(handler))
        {
            if (LOG.isDebugEnabled())
            {
                LOG.debug("supports Whole: {}",handler.getName());
            }
            partial = false;
            Class<?> onMessageClass = ReflectUtils.findGenericClassFor(handler,MessageHandler.Whole.class);
            if (LOG.isDebugEnabled())
            {
                LOG.debug("Whole message class: {}",onMessageClass);
            }
            metadatas.add(new MessageHandlerMetadata(handler,onMessageClass,partial));
        }

        registered.put(handler,metadatas);
        return metadatas;
    }
View Full Code Here

    public void testByteArrayPartial() throws DeploymentException
    {
        List<MessageHandlerMetadata> metadatas = factory.getMetadata(ByteArrayPartialHandler.class);
        Assert.assertThat("Metadata.list.size",metadatas.size(),is(1));

        MessageHandlerMetadata handlerMetadata = metadatas.get(0);
        DecoderMetadata decoderMetadata = decoders.getMetadataFor(handlerMetadata.getMessageClass());
        Assert.assertThat("Message Type",decoderMetadata.getMessageType(),is(MessageType.BINARY));
        Assert.assertThat("Message Class",handlerMetadata.getMessageClass(),is((Type)byte[].class));
    }
View Full Code Here

    public void testStringPartial() throws DeploymentException
    {
        List<MessageHandlerMetadata> metadatas = factory.getMetadata(StringPartialHandler.class);
        Assert.assertThat("Metadata.list.size",metadatas.size(),is(1));

        MessageHandlerMetadata handlerMetadata = metadatas.get(0);
        DecoderMetadata decoderMetadata = decoders.getMetadataFor(handlerMetadata.getMessageClass());
        Assert.assertThat("Message Type",decoderMetadata.getMessageType(),is(MessageType.TEXT));
        Assert.assertThat("Message Class",handlerMetadata.getMessageClass(),is((Type)String.class));
    }
View Full Code Here

        // Executor executor = null;

        EndpointInstance ei = new EndpointInstance(websocket,config,metadata);

        EventDriver driver = new JsrEndpointEventDriver(policy,ei);
        DummyConnection connection = new DummyConnection();
        session = new JsrSession(requestURI,driver,connection,container,id);
    }
View Full Code Here

        container = new ClientContainer();
        String id = JsrSessionTest.class.getSimpleName();
        URI requestURI = URI.create("ws://localhost/" + id);
        WebSocketPolicy policy = WebSocketPolicy.newClientPolicy();
        ClientEndpointConfig config = new EmptyClientEndpointConfig();
        DummyEndpoint websocket = new DummyEndpoint();
        SimpleEndpointMetadata metadata = new SimpleEndpointMetadata(websocket.getClass());
        // Executor executor = null;

        EndpointInstance ei = new EndpointInstance(websocket,config,metadata);

        EventDriver driver = new JsrEndpointEventDriver(policy,ei);
View Full Code Here

    @Test
    public void testAbstractEchoInstance() throws Exception
    {
        WebSocketContainer container = ContainerProvider.getWebSocketContainer();
        EchoStringEndpoint echoer = new EchoStringEndpoint();
        Assert.assertThat(echoer,instanceOf(javax.websocket.Endpoint.class));
        // Issue connect using instance of class that extends abstract that extends Endpoint
        Session session = container.connectToServer(echoer,serverUri);
        if (LOG.isDebugEnabled())
            LOG.debug("Client Connected: {}",session);
View Full Code Here

            {
                // not a binary fruit object
                throw new DecodeException(bytes,"Not an encoded Binary Fruit object");
            }

            Fruit fruit = new Fruit();
            fruit.name = getUTF8String(bytes);
            fruit.color = getUTF8String(bytes);
            return fruit;
        }
        catch (BufferUnderflowException e)
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata

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.