org.eclipse.californium.core.coap.Request.setConfirmable()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中org.eclipse.californium.core.coap.Request.setConfirmable方法的一些代码示例,展示了Request.setConfirmable的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setConfirmable方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:setConfirmable

Request.setConfirmable介绍

暂无

代码示例

代码示例来源:origin: eclipse/californium

public CC05(String serverURI) {
  super(CC05.class.getSimpleName());
  // create the request
  Request request = Request.newGet();
  request.setConfirmable(false);
  // set the parameters and execute the request
  executeRequest(request, serverURI, RESOURCE_URI);
}

代码示例来源:origin: eclipse/californium

public CC06(String serverURI) {
  super(CC06.class.getSimpleName());
  // create the request
  Request request = Request.newDelete();
  request.setConfirmable(false);
  // set the parameters and execute the request
  executeRequest(request, serverURI, RESOURCE_URI);
}

代码示例来源:origin: eclipse/californium

public CC09(String serverURI) {
  super(CC09.class.getSimpleName());
  // create the request
  Request request = new Request(Code.GET);
  request.setConfirmable(true);
  // set the parameters and execute the request
  executeRequest(request, serverURI, RESOURCE_URI);
}

代码示例来源:origin: eclipse/californium

public CC08(String serverURI) {
  super(CC08.class.getSimpleName());
  // create the request
  Request request = new Request(Code.POST);
  request.setConfirmable(false);
  // add payload
  request.setPayload("TD_COAP_CORE_08");
  request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  // set the parameters and execute the request
  executeRequest(request, serverURI, RESOURCE_URI);
}

代码示例来源:origin: eclipse/californium

public CC07(String serverURI) {
  super(CC07.class.getSimpleName());
  // create the request
  Request request = new Request(Code.PUT);
  request.setConfirmable(false);
  // add payload
  request.setPayload("TD_COAP_CORE_07");
  request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  // set the parameters and execute the request
  executeRequest(request, serverURI, RESOURCE_URI);
}

代码示例来源:origin: eclipse/leshan

@Override
public void visit(BootstrapDeleteRequest request) {
  coapRequest = Request.newDelete();
  coapRequest.setConfirmable(true);
  EndpointContext context = EndpointContextUtil.extractContext(destination);
  coapRequest.setDestinationContext(context);
  setTarget(coapRequest, request.getPath());
}

代码示例来源:origin: eclipse/leshan

@Override
public void visit(BootstrapFinishRequest request) {
  coapRequest = Request.newPost();
  coapRequest.setConfirmable(true);
  EndpointContext context = EndpointContextUtil.extractContext(destination);
  coapRequest.setDestinationContext(context);
  // root path
  if (rootPath != null) {
    for (String rootPathPart : rootPath.split("/")) {
      if (!StringUtils.isEmpty(rootPathPart)) {
        coapRequest.getOptions().addUriPath(rootPathPart);
      }
    }
  }
  coapRequest.getOptions().addUriPath("bs");
}

代码示例来源:origin: org.eclipse.leshan/leshan-server-cf

postSecurity.getOptions().addUriPath("0");
postSecurity.getOptions().addUriPath(key.toString());
postSecurity.setConfirmable(true);
postSecurity.setDestination(targetAddress);
postSecurity.setDestinationPort(targetPort);

代码示例来源:origin: org.eclipse.leshan/leshan-server-cf

postServer.getOptions().addUriPath("1");
postServer.getOptions().addUriPath(key.toString());
postServer.setConfirmable(true);
postServer.setDestination(targetAddress);
postServer.setDestinationPort(targetPort);

代码示例来源:origin: org.eclipse.californium/californium-proxy

outgoingRequest.setConfirmable(type == Type.CON);

代码示例来源:origin: eclipse/californium

outgoingRequest.setConfirmable(incomingRequest.getType() == Type.CON);

代码示例来源:origin: eclipse/leshan

@Override
public void visit(BootstrapWriteRequest request) {
  coapRequest = Request.newPut();
  coapRequest.setConfirmable(true);
  ContentFormat format = request.getContentFormat();
  coapRequest.getOptions().setContentFormat(format.getCode());
  coapRequest.setPayload(encoder.encode(request.getNode(), format, request.getPath(), model));
  setTarget(coapRequest, request.getPath());
}

代码示例来源:origin: eclipse/californium

@Test
public void testNonconfirmable() throws Exception {
  createSimpleServer();
  // send request
  Request request = new Request(CoAP.Code.POST);
  request.setConfirmable(false);
  request.setDestination(InetAddress.getLoopbackAddress());
  request.setDestinationPort(serverPort);
  request.setPayload("client says hi");
  request.send();
  System.out.println("client sent request");
  // receive response and check
  Response response = request.waitForResponse(1000);
  assertNotNull("Client received no response", response);
  System.out.println("client received response");
  assertEquals(response.getPayloadString(), SERVER_RESPONSE);
}

代码示例来源:origin: org.eclipse.leshan/leshan-server-cf

Request deleteAll = Request.newDelete();
deleteAll.getOptions().addUriPath("/");
deleteAll.setConfirmable(true);
deleteAll.setDestination(exchange.getSourceAddress());
deleteAll.setDestinationPort(exchange.getSourcePort());

代码示例来源:origin: eclipse/californium

@Test
public void testNonConfirmable() throws Exception {
  // send request
  Request req2acc = new Request(Code.POST);
  req2acc.setConfirmable(false);
  req2acc.setURI(getUri(ACC_RESOURCE));
  req2acc.setPayload("client says hi");
  req2acc.send();
  // receive response and check
  Response response = req2acc.waitForResponse(1000);
  assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.NON);
  Request req2noacc = new Request(Code.POST);
  req2noacc.setConfirmable(false);
  req2noacc.setURI(getUri(NO_ACC_RESOURCE));
  req2noacc.setPayload("client says hi");
  req2noacc.send();
  // receive response and check
  response = req2noacc.waitForResponse(1000);
  assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.NON);
}

代码示例来源:origin: eclipse/californium

@Test
public void testConfirmable() throws Exception {
  // send request
  Request req2acc = new Request(Code.POST);
  req2acc.setConfirmable(true);
  req2acc.setURI(getUri(ACC_RESOURCE));
  req2acc.setPayload("client says hi");
  req2acc.send();
  // receive response and check
  Response response = req2acc.waitForResponse(1000);
  assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.CON);
  Request req2noacc = new Request(Code.POST);
  req2noacc.setConfirmable(true);
  req2noacc.setURI(getUri(NO_ACC_RESOURCE));
  req2noacc.setPayload("client says hi");
  req2noacc.send();
  // receive response and check
  response = req2noacc.waitForResponse(1000);
  assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.ACK);
}

相关文章