本文整理了Java中org.eclipse.californium.core.coap.Response.getType
方法的一些代码示例,展示了Response.getType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getType
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Response
类名称:Response
方法名:getType
暂无
代码示例来源:origin: eclipse/californium
public void check(Response response) {
Type type = response.getType();
storage.put(key, type);
}
});
代码示例来源:origin: eclipse/californium
/**
* Returns true if the specified response is still in transit. A response is
* in transit if it has not yet been acknowledged, rejected or its current
* transmission has not yet timed out.
*/
private static boolean isInTransit(final Response response) {
Type type = response.getType();
boolean acked = response.isAcknowledged();
boolean timeout = response.isTimedOut();
boolean result = type == Type.CON && !acked && !timeout;
return result;
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.NON, response.getType());
// Code = 68 (2.04 Changed) or 65 (2.01 Created)
success &= checkInts(expectedResponseCodes,
response.getCode().value, "code");
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.NON, response.getType());
// Code = 65(2.01 Created) or 68 (2.04 changed)
success &= checkInts(expectedResponseCodes,
response.getCode().value, "code");
return success;
}
}
代码示例来源:origin: eclipse/californium
@Override
public String toString() {
String payload = getPayloadTracingString();
return String.format("%s-%-6s MID=%5d, Token=%s, OptionSet=%s, %s", getType(), getCode(), getMID(), getTokenString(), getOptions(), payload);
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.ACK, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkTypes(new Type[] { Type.ACK, Type.CON },
response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.CON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkTypes(new Type[] { Type.ACK, Type.CON },
response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.CON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.ACK, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= hasNoToken(response);
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.ACK, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
success &= checkInt(request.getMID(), response.getMID(), "MID");
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.CON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
// Token value = the same value as in the request sent by the client
// in step 2
success &= checkToken(request.getToken(), response.getToken());
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.ACK, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
success &= checkOption(MediaTypeRegistry.APPLICATION_LINK_FORMAT, response.getOptions().getContentFormat(), "Content-Format");
success &= checkDiscoveryAttributes(EXPECTED_HREF, response.getPayloadString());
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.ACK, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
success &= checkOption(MediaTypeRegistry.APPLICATION_LINK_FORMAT, response.getOptions().getContentFormat(), "Content-Format");
success &= checkDiscoveryAttributes(EXPECTED_IF, response.getPayloadString());
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.CON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
success &= checkToken(request.getToken(), response.getToken());
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
success &= hasObserve(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.ACK, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
success &= checkOption(MediaTypeRegistry.APPLICATION_LINK_FORMAT, response.getOptions().getContentFormat(), "Content format");
success &= hasNonEmptyPalyoad(response);
success &= checkDiscoveryAttributes(EXPECTED_RT, response.getPayloadString());
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.CON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
success &= checkToken(request.getToken(), response.getToken());
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
success &= hasObserve(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.CON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value, response.getCode().value, "code");
success &= checkToken(request.getToken(), response.getToken());
success &= hasContentType(response);
success &= hasNonEmptyPalyoad(response);
success &= hasObserve(response);
return success;
}
}
代码示例来源:origin: eclipse/californium
@Test
public void testAdvancedUsesTypeFromRequest() throws Exception {
String uri = TestTools.getUri(serverEndpoint, TARGET);
CoapClient client = new CoapClient(uri).useExecutor();
// Set NONs but expecting CONs as specified in request
client.useNONs();
Request request = new Request(Code.GET, Type.CON);
CoapResponse resp = client.advanced(request);
Assert.assertEquals(Type.ACK, resp.advanced().getType());
Assert.assertEquals(CONTENT_1, resp.getResponseText());
}
内容来源于网络,如有侵权,请联系作者删除!