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

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

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

Request.<init>介绍

[英]Creates a request of type CON for a CoAP code.
[中]为CoAP代码创建CON类型的请求。

代码示例

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

  1. /**
  2. * Convenience factory method to construct a DELETE request and equivalent
  3. * to <code>new Request(Code.DELETE);</code>
  4. *
  5. * @return a new DELETE request
  6. */
  7. public static Request newDelete() {
  8. return new Request(Code.DELETE);
  9. }
  10. }

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

  1. public CC21(String serverURI) {
  2. super(CC21.class.getSimpleName());
  3. Request request = new Request(Code.GET, Type.CON);
  4. executeRequest(request, serverURI, RESOURCE_URI);
  5. }

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

  1. public CC16(String serverURI) {
  2. super(CC16.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // set the parameters and execute the request
  6. executeRequest(request, serverURI, RESOURCE_URI);
  7. }

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

  1. public CC13(String serverURI) {
  2. super(CC13.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // set the parameters and execute the request
  6. executeRequest(request, serverURI, RESOURCE_URI);
  7. }

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

  1. public CC17(String serverURI) {
  2. super(CC17.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.NON);
  5. // set the parameters and execute the request
  6. executeRequest(request, serverURI, RESOURCE_URI);
  7. }

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

  1. public CB02(String serverURI) {
  2. super(CB02.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // set the parameters and execute the request
  6. executeRequest(request, serverURI, RESOURCE_URI);
  7. }

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

  1. public CC11(String serverURI) {
  2. super(CC11.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. request.setToken(new byte[]{(byte) 0xBE, (byte) 0xEF});
  6. executeRequest(request, serverURI, RESOURCE_URI);
  7. }

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

  1. public CO04(String serverURI) {
  2. super(CO04.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // set Observe option
  6. request.setObserve();
  7. // set the parameters and execute the request
  8. executeRequest(request, serverURI, RESOURCE_URI);
  9. }

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

  1. public CC12(String serverURI) {
  2. super(CC12.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // request.requiresToken(false); // TODO
  6. request.setToken(new byte[0]);
  7. // set the parameters and execute the request
  8. executeRequest(request, serverURI, RESOURCE_URI);
  9. }

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

  1. public CC09(String serverURI) {
  2. super(CC09.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET);
  5. request.setConfirmable(true);
  6. // set the parameters and execute the request
  7. executeRequest(request, serverURI, RESOURCE_URI);
  8. }

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

  1. public CL03(String serverURI) {
  2. super(CL03.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // set query
  6. request.getOptions().addUriQuery(EXPECTED_RT);
  7. // set the parameters and execute the request
  8. executeRequest(request, serverURI, RESOURCE_URI);
  9. }

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

  1. public CL05(String serverURI) {
  2. super(CL05.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET, Type.CON);
  5. // set query
  6. request.getOptions().addUriQuery(EXPECTED_IF);
  7. // set the parameters and execute the request
  8. executeRequest(request, serverURI, RESOURCE_URI);
  9. }

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

  1. public CC08(String serverURI) {
  2. super(CC08.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.POST);
  5. request.setConfirmable(false);
  6. // add payload
  7. request.setPayload("TD_COAP_CORE_08");
  8. request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  9. // set the parameters and execute the request
  10. executeRequest(request, serverURI, RESOURCE_URI);
  11. }

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

  1. public CC07(String serverURI) {
  2. super(CC07.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.PUT);
  5. request.setConfirmable(false);
  6. // add payload
  7. request.setPayload("TD_COAP_CORE_07");
  8. request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  9. // set the parameters and execute the request
  10. executeRequest(request, serverURI, RESOURCE_URI);
  11. }

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

  1. @Test public void sendRequestExpectSent() {
  2. Request message = new Request(CoAP.Code.GET);
  3. stack.sendRequest(message);
  4. verify(outbox).sendRequest(any(Exchange.class), eq(message));
  5. }

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

  1. @Test
  2. public void testAddListOfMessageObservers() {
  3. Request ping = new Request(null, Type.CON);
  4. List<MessageObserver> observers = new ArrayList<>();
  5. observers.add(new MessageObserverAdapter() {});
  6. observers.add(new MessageObserverAdapter() {});
  7. ping.addMessageObservers(observers);
  8. assertThat(ping.getMessageObservers().size(), is(2));
  9. }

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

  1. @Test
  2. public void testMultipleAddListOfMessageObservers() {
  3. Request ping = new Request(null, Type.CON);
  4. List<MessageObserver> observers = new ArrayList<>();
  5. observers.add(new MessageObserverAdapter() {});
  6. observers.add(new MessageObserverAdapter() {});
  7. ping.addMessageObservers(observers);
  8. observers.add(new MessageObserverAdapter() {});
  9. observers.add(new MessageObserverAdapter() {});
  10. ping.addMessageObservers(observers);
  11. assertThat(ping.getMessageObservers().size(), is(6));
  12. }

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

  1. @Test
  2. public void testAddEmptyListOfMessageObservers() {
  3. Request ping = new Request(null, Type.CON);
  4. List<MessageObserver> observers = Collections.emptyList();
  5. ping.addMessageObservers(observers);
  6. assertThat(ping.getMessageObservers().size(), is(0));
  7. }

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

  1. @Test public void cancelledMessageExpectExchangeComplete() {
  2. Request request = new Request(CoAP.Code.GET);
  3. ArgumentCaptor<Exchange> exchangeCaptor = ArgumentCaptor.forClass(Exchange.class);
  4. doNothing().when(outbox).sendRequest(exchangeCaptor.capture(), eq(request));
  5. stack.sendRequest(request);
  6. // Capture exchange
  7. Exchange exchange = exchangeCaptor.getValue();
  8. assertFalse(exchange.isComplete());
  9. request.setCanceled(true);
  10. assertTrue(exchange.isComplete());
  11. }
  12. }

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

  1. @Test
  2. public void testMultipleAddMessageObserver() {
  3. Request ping = new Request(null, Type.CON);
  4. ping.addMessageObserver(new MessageObserverAdapter() {});
  5. ping.addMessageObserver(new MessageObserverAdapter() {});
  6. ping.addMessageObserver(new MessageObserverAdapter() {});
  7. assertThat(ping.getMessageObservers().size(), is(3));
  8. }

相关文章