Response code fix

This commit is contained in:
Andrii Shvaika 2024-02-02 17:23:11 +02:00
parent 42ae98023b
commit a89802e801
2 changed files with 3 additions and 5 deletions

View File

@ -239,7 +239,7 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap
String awaitAlias = "await Json Test Subscribe To AttributesUpdates (client.getObserveRelation)";
await(awaitAlias)
.atMost(DEFAULT_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.until(() -> ResponseCode.VALID.equals(callbackCoap.getResponseCode()) &&
.until(() -> ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) &&
callbackCoap.getObserve() != null &&
0 == callbackCoap.getObserve().intValue());
if (emptyCurrentStateNotification) {
@ -286,7 +286,7 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap
CoapObserveRelation observeRelation = client.getObserveRelation(callbackCoap);
await(awaitAlias)
.atMost(DEFAULT_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.until(() -> ResponseCode.VALID.equals(callbackCoap.getResponseCode()) &&
.until(() -> ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) &&
callbackCoap.getObserve() != null &&
0 == callbackCoap.getObserve().intValue());

View File

@ -485,9 +485,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
TbCoapObservationState attrs = state.getAttrs();
if (attrs != null) {
try {
Response resp = state.getAdaptor().convertToPublish(msg);
Response response = new Response(ResponseCode.VALID);
response.setPayload(resp.getPayload());
Response response = state.getAdaptor().convertToPublish(msg);
response.getOptions().setObserve(attrs.getObserveCounter().getAndIncrement());
respond(attrs.getExchange(), response, state.getContentFormat());
} catch (AdaptorException e) {