Package ch.ethz.inf.vs.californium.coap

Examples of ch.ethz.inf.vs.californium.coap.Request.send()


      EndpointManager.getEndpointManager().setDefaultSecureEndpoint(dtlsEndpoint);
    }
   
    // execute request
    try {
      request.send();

      // loop for receiving multiple responses
      do {
 
        // receive response
View Full Code Here


        validationRequest.getOptions().addETag(etag);
      }
      Response response = null;
     
      try {
        validationRequest.send();
        response = validationRequest.waitForResponse();
       
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
View Full Code Here

                response.getCode().value, "code");
          }
        }
      });
      // enable response queue for synchronous I/O
      asyncRequest.send();

      long time = response.getOptions().getMaxAge() * 1000;

      response = request.waitForResponse(time + 1000);
      System.out.println("received " + response);
View Full Code Here

                          System.out.println("Received: " + response.getCode());
                          System.out.println("+++++++++++++++++++++++");
                        }
                      }
                    });
                asyncRequest.send();
              }

            } else if (!timedOut) {
              timedOut = true;
              l = observeLoop / 2;
View Full Code Here

      // Client is requested to update the /obs resource on Server
      System.out.println("+++++ Sending PUT +++++");
      Request asyncRequest = new Request(Code.PUT, Type.CON);
      asyncRequest.setPayload(newValue, contentType);
      asyncRequest.setURI(uri);
      asyncRequest.send();

      response = asyncRequest.waitForResponse(6000);

      // checking the response
      if (response != null) {
View Full Code Here

            if (response != null) {
              checkInt(EXPECTED_RESPONSE_CODE_1.value, response.getCode().value, "code");
            }
          }
        });
        asyncRequest.send();
 
        time = response.getOptions().getMaxAge() * 1000;
 
        response = request.waitForResponse(time + 1000);
 
View Full Code Here

    try {
      Request request = new Request(null);
      request.setType(Type.CON);
      request.setToken(new byte[0]);
      request.setURI(uri);
      request.send().waitForResponse(5000);
      request.cancel();
      return request.isRejected();
    } catch (InterruptedException e) {
      // waiting was interrupted, which is fine
    }
View Full Code Here

    cancel.setDestination(request.getDestination());
    cancel.setDestinationPort(request.getDestinationPort());
    // dispatch final response to the same message observers
    for (MessageObserver mo: request.getMessageObservers())
      cancel.addMessageObserver(mo);
    cancel.send();
    // cancel old ongoing request
    request.cancel();
    this.canceled = true;
  }
 
View Full Code Here

      request.setType(Type.CON);
      request.setToken(new byte[0]);
      request.setURI(address);

            System.out.println("++++++ Sending Ping ++++++");
      request.send().waitForResponse(5000);
      return request.isRejected();

    } catch (Exception e) {
      e.printStackTrace();
      return false;
View Full Code Here

          if (l==1) {
                  System.out.println("+++++ Unrelated GET +++++");
            // GET with different Token
            Request asyncRequest = Request.newGet();
            asyncRequest.setURI(uri);
            asyncRequest.send();
            response = asyncRequest.waitForResponse(time/2);
            if (response!=null) {
              success &= checkToken(asyncRequest.getToken(), response.getToken());
              success &= hasObserve(response, true); // inverted
                      System.out.println("+++++ OK +++++");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.