本文整理了Java中org.eclipse.californium.core.coap.Request.<init>
方法的一些代码示例,展示了Request.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.<init>
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:<init>
[英]Creates a request of type CON for a CoAP code.
[中]为CoAP代码创建CON类型的请求。
代码示例来源:origin: eclipse/californium
/**
* Convenience factory method to construct a DELETE request and equivalent
* to <code>new Request(Code.DELETE);</code>
*
* @return a new DELETE request
*/
public static Request newDelete() {
return new Request(Code.DELETE);
}
}
代码示例来源:origin: eclipse/californium
public CC21(String serverURI) {
super(CC21.class.getSimpleName());
Request request = new Request(Code.GET, Type.CON);
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CC16(String serverURI) {
super(CC16.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CC13(String serverURI) {
super(CC13.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CC17(String serverURI) {
super(CC17.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.NON);
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CB02(String serverURI) {
super(CB02.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CC11(String serverURI) {
super(CC11.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
request.setToken(new byte[]{(byte) 0xBE, (byte) 0xEF});
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CO04(String serverURI) {
super(CO04.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// set Observe option
request.setObserve();
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CC12(String serverURI) {
super(CC12.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// request.requiresToken(false); // TODO
request.setToken(new byte[0]);
// 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 CL03(String serverURI) {
super(CL03.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// set query
request.getOptions().addUriQuery(EXPECTED_RT);
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
代码示例来源:origin: eclipse/californium
public CL05(String serverURI) {
super(CL05.class.getSimpleName());
// create the request
Request request = new Request(Code.GET, Type.CON);
// set query
request.getOptions().addUriQuery(EXPECTED_IF);
// 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/californium
@Test public void sendRequestExpectSent() {
Request message = new Request(CoAP.Code.GET);
stack.sendRequest(message);
verify(outbox).sendRequest(any(Exchange.class), eq(message));
}
代码示例来源:origin: eclipse/californium
@Test
public void testAddListOfMessageObservers() {
Request ping = new Request(null, Type.CON);
List<MessageObserver> observers = new ArrayList<>();
observers.add(new MessageObserverAdapter() {});
observers.add(new MessageObserverAdapter() {});
ping.addMessageObservers(observers);
assertThat(ping.getMessageObservers().size(), is(2));
}
代码示例来源:origin: eclipse/californium
@Test
public void testMultipleAddListOfMessageObservers() {
Request ping = new Request(null, Type.CON);
List<MessageObserver> observers = new ArrayList<>();
observers.add(new MessageObserverAdapter() {});
observers.add(new MessageObserverAdapter() {});
ping.addMessageObservers(observers);
observers.add(new MessageObserverAdapter() {});
observers.add(new MessageObserverAdapter() {});
ping.addMessageObservers(observers);
assertThat(ping.getMessageObservers().size(), is(6));
}
代码示例来源:origin: eclipse/californium
@Test
public void testAddEmptyListOfMessageObservers() {
Request ping = new Request(null, Type.CON);
List<MessageObserver> observers = Collections.emptyList();
ping.addMessageObservers(observers);
assertThat(ping.getMessageObservers().size(), is(0));
}
代码示例来源:origin: eclipse/californium
@Test public void cancelledMessageExpectExchangeComplete() {
Request request = new Request(CoAP.Code.GET);
ArgumentCaptor<Exchange> exchangeCaptor = ArgumentCaptor.forClass(Exchange.class);
doNothing().when(outbox).sendRequest(exchangeCaptor.capture(), eq(request));
stack.sendRequest(request);
// Capture exchange
Exchange exchange = exchangeCaptor.getValue();
assertFalse(exchange.isComplete());
request.setCanceled(true);
assertTrue(exchange.isComplete());
}
}
代码示例来源:origin: eclipse/californium
@Test
public void testMultipleAddMessageObserver() {
Request ping = new Request(null, Type.CON);
ping.addMessageObserver(new MessageObserverAdapter() {});
ping.addMessageObserver(new MessageObserverAdapter() {});
ping.addMessageObserver(new MessageObserverAdapter() {});
assertThat(ping.getMessageObservers().size(), is(3));
}
内容来源于网络,如有侵权,请联系作者删除!