Package de.uniluebeck.itm.ncoap.message

Examples of de.uniluebeck.itm.ncoap.message.CoapRequest


        URI serviceURI = new URI("coap", null, "localhost", server.getPort(), PATH, null, null);
        token = new Token(new byte[]{1, 2, 3, 4});
        messageID = 1;

        coapRequest1 = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, serviceURI);
        coapRequest1.setMessageID(messageID);
        coapRequest1.setToken(token);

        coapRequest2 = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, serviceURI);
        coapRequest2.setMessageID(messageID);
        coapRequest2.setToken(token);
    }
View Full Code Here


        service = new NotObservableTestWebservice(PATH_TO_SERVICE, PAYLOAD, 0, 3000, server.getExecutor());
        server.registerService(service);

        endpoint = new DummyEndpoint();
        URI targetUri = new URI("coap://localhost:" + server.getPort() + PATH_TO_SERVICE);
        request = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, targetUri);
        request.setMessageID(12345);
    }
View Full Code Here

        client = new CoapClientApplication();
        clientCallback = new SpecificClientCallback();

        URI targetUri = new URI("coap://localhost:" + server.getPort() + PATH_TO_SERVICE);
        request = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, targetUri);
        request.setObserve(0);
    }
View Full Code Here

        //Create client, callbacks and requests
        client = new CoapClientApplication();

        for(int i = 0; i < NUMBER_OF_PARALLEL_REQUESTS; i++){
            clientCallbacks[i] = new ClientTestCallback();
            requests[i] new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET,
                    new URI("coap://localhost:" + server.getPort() + "/service" + (i+1)));
        }
    }
View Full Code Here

        boolean useProxy = arguments.getProxyAddress() != null;

        MessageType.Name messageType = arguments.isNon() ? MessageType.Name.NON : MessageType.Name.CON;

        CoapRequest coapRequest = new CoapRequest(messageType, MessageCode.Name.GET, webserviceURI, useProxy);

        //Observe or not?
        if(arguments.isObserve())
            coapRequest.setObserve(0);

        //Determine recipient (proxy or webservice host)
        InetSocketAddress recipient;
        if(useProxy)
            recipient = new InetSocketAddress(InetAddress.getByName(arguments.getProxyAddress()),
View Full Code Here

        client = new CoapClientApplication("CoAP Testclient");
        callback = new ClientTestCallback();

        URI targetUri = new URI("coap://localhost:" + testEndpoint.getPort() + "/testpath");
        coapRequest = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, targetUri);
    }
View Full Code Here

        serviceUri = new URI("coap", null, "localhost", -1, "/test", null, null);
    }

    @Override
    public void createTestScenario() throws Exception {
        CoapRequest coapRequest = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, serviceUri);
        coapRequest.setObserve(0);
        coapRequest.setAccept(111);
        client.sendCoapRequest(coapRequest, clientCallback, serverSocket);
        Thread.sleep(2000);
        service.setResourceStatus(2, 0);
        Thread.sleep(2000);
    }
View Full Code Here

        URI serviceURI = new URI("coap", null, "localhost", server.getPort(), PATH, null, null);
        token = new Token(new byte[]{1, 2, 3, 4});
        messageID = 1;

        coapRequest1 = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, serviceURI);
        coapRequest1.setMessageID(messageID);
        coapRequest1.setToken(token);

        coapRequest2 = new CoapRequest(MessageType.Name.CON, MessageCode.Name.GET, serviceURI);
        coapRequest2.setMessageID(messageID);
        coapRequest2.setToken(token);
    }
View Full Code Here

        stopObservation(remoteEndpoint, token);
    }


    private void handleOutgoingCoapRequest(ChannelHandlerContext ctx, MessageEvent me) {
        CoapRequest coapRequest = (CoapRequest) me.getMessage();

        long observe = coapRequest.getObserve();
        if(observe != UintOptionValue.UNDEFINED){
            InetSocketAddress remoteEndpoint = (InetSocketAddress) me.getRemoteAddress();
            Token token = coapRequest.getToken();

            if(observe == 0){
                log.debug("Add observation (remote endpoint: {}, token: {})", remoteEndpoint, token);
                startObservation(remoteEndpoint, token);
            }
View Full Code Here

TOP

Related Classes of de.uniluebeck.itm.ncoap.message.CoapRequest

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.