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

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


      do {
 
        // receive response
        Response response = null;
        try {
          response = request.waitForResponse();
        } catch (InterruptedException e) {
          System.err.println("Failed to receive response: " + e.getMessage());
          System.exit(ERR_RESPONSE_FAILED);
        }
 
View Full Code Here


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

      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) {
        success &= checkInt(EXPECTED_RESPONSE_CODE_1.value, response.getCode().value, "code");
      }
View Full Code Here

                  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 +++++");
            } else {
View Full Code Here

     
      request.send();
     
      // receive response
      try {
        Response response = request.waitForResponse(1000);
       
        if (response != null) {
          // response received, output a pretty-print
          System.out.println(response);
        } else {
View Full Code Here

  public static void selfTest() {
    try {
      Request request = Request.newGet();
      request.setURI("localhost:5683/benchmark");
      request.send();
      Response response = request.waitForResponse(1000);
      System.out.println("received "+response);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

  public static void selfTest() {
    try {
      Request request = Request.newGet();
      request.setURI("localhost:5683/hello");
      request.send();
      Response response = request.waitForResponse(1000);
      System.out.println("received "+response);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      return new Response(ResponseCode.INTERNAL_SERVER_ERROR);
    }

    try {
      // receive the response // TODO: don't wait for ever
      Response receivedResponse = outgoingRequest.waitForResponse();

      if (receivedResponse != null) {
        LOGGER.finer("Coap response received.");

        // create the real response for the original request
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.