本文整理了Java中org.eclipse.californium.core.coap.Request.setMID
方法的一些代码示例,展示了Request.setMID
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setMID
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:setMID
暂无
代码示例来源:origin: org.eclipse.californium/californium-core
request.setMID(currendMID.getAndIncrement() & 0x0000FFFF);
代码示例来源:origin: eclipse/californium
@Test
public void testRegisterOutboundRequestRejectsOtherRequestWithAlreadyUsedMid() {
Exchange exchange = newOutboundRequest();
store.registerOutboundRequest(exchange);
// WHEN registering another request with the same MID
Exchange newExchange = newOutboundRequest();
newExchange.getCurrentRequest().setMID(exchange.getCurrentRequest().getMID());
try {
store.registerOutboundRequest(newExchange);
fail("should have thrown IllegalArgumentException");
} catch (IllegalArgumentException e) {
// THEN the newExchange is not put to the store
KeyMID key = KeyMID.fromOutboundMessage(exchange.getCurrentRequest());
Exchange exchangeFromStore = store.get(key);
assertThat(exchangeFromStore, is(exchange));
assertThat(exchangeFromStore, is(not(newExchange)));
}
}
代码示例来源:origin: eclipse/californium
@Test public void testRequestParsing() {
Request request = new Request(Code.POST);
request.setType(Type.NON);
request.setMID(expectedMid);
request.setToken(new byte[] { 11, 82, -91, 77, 3 });
request.getOptions().addIfMatch(new byte[] { 34, -17 }).addIfMatch(new byte[] { 88, 12, -2, -99, 5 })
.setContentFormat(40).setAccept(40);
RawData rawData = serializer.serializeRequest(request);
// MessageHeader header = parser.parseHeader(rawData);
// assertTrue(CoAP.isRequest(header.getCode()));
//
// Request result = parser.parseRequest(rawData);
Request result = (Request) parser.parseMessage(rawData);
assertEquals(request.getMID(), result.getMID());
assertArrayEquals(request.getToken(), result.getToken());
assertEquals(request.getOptions().asSortedList(), result.getOptions().asSortedList());
}
代码示例来源:origin: eclipse/californium
request.setMID(1234);
client.sendRequest(request);
request.setMID(4711);
client.sendRequest(request);
内容来源于网络,如有侵权,请联系作者删除!