@Test public void testIsObserveMessage() { assertFalse(resp.isObserveMessage()); short observe = 0; byte[] observeBytes = BitUtil.splitShortToBytes(observe); CoAPOptionHeader observeOpt = new CoAPOptionHeader( CoAPOptionName.OBSERVE, observeBytes); resp.addOptionHeader(observeOpt); assertTrue(resp.isObserveMessage()); resp.removeOptionHeader(observeOpt); double max = Math.pow(2, 16) - 1; Double maxDouble = max; int unsignedShortMax = maxDouble.intValue(); byte[] shortBytes = BitUtil.splitIntToBytes(unsignedShortMax); byte[] shortValue = new byte[]{ shortBytes[2], shortBytes[3] }; observeOpt = new CoAPOptionHeader(CoAPOptionName.OBSERVE, shortValue); int observeValue = BitUtil.shortToUnsignedInt(observeOpt.getValue()); assertEquals(observeValue, unsignedShortMax); }
public boolean isObserveMessage() { return headers.containsKey(CoAPOptionName.OBSERVE); }
CoAPMessage { public boolean isObserveMessage() { return headers.containsKey(CoAPOptionName.OBSERVE); } }
CoAPMessage { public boolean isObserveMessage() { return headers.containsKey(CoAPOptionName.OBSERVE); } CoAPMessage(int version, CoAPMessageType messageType,
            CoAPCode methodCode, int messageId, byte[] token);  CoAPMessage(CoAPMessageType messageType, CoAPCode methodCode,
            int messageId, byte[] token); }
CoAPMessage { public boolean isObserveMessage() { return headers.containsKey(CoAPOptionName.OBSERVE); } CoAPMessage(int version, CoAPMessageType messageType,
            CoAPCode methodCode, int messageId, byte[] token);  CoAPMessage(CoAPMessageType messageType, CoAPCode methodCode,
            int messageId, byte[] token); void setVersion(short version); int getVersion(); void setMessageType(CoAPMessageType messageType); CoAPMessageType getMessageType(); int getOptionCount(); void setCode(CoAPCode code); CoAPCode getCode(); void setToken(byte[] token); byte[] getToken(); void setMessageId(int messageId); int getMessageId(); synchronized boolean addOptionHeader(CoAPOptionHeader option); boolean removeOptionHeader(CoAPOptionHeader option); void setPayload(byte[] payload); byte[] getPayload(); List<CoAPOptionHeader> getOptionHeaders(); List<CoAPOptionHeader> getOptionHeaders(CoAPOptionName optionName); void setOptionHeaders(List<CoAPOptionHeader> headers); int getRetransmissions(); int getTimeout(); void messageRetransmitted(); boolean messageCanceled(); void setMessageCanceled(boolean canceled); void setSocketAddress(InetSocketAddress remoteSocketAddress); InetSocketAddress getSocketAddress(); String getIdentifier(); CoAPOptionHeader getUriHostOptionHeader(); byte[] encoded(); boolean isObserveMessage(); long getMaxAge(); String logMessage(); }
CoAPMessage { public boolean isObserveMessage() { return headers.containsKey(CoAPOptionName.OBSERVE); } CoAPMessage(int version, CoAPMessageType messageType,
            CoAPCode methodCode, int messageId, byte[] token);  CoAPMessage(CoAPMessageType messageType, CoAPCode methodCode,
            int messageId, byte[] token); void setVersion(short version); int getVersion(); void setMessageType(CoAPMessageType messageType); CoAPMessageType getMessageType(); int getOptionCount(); void setCode(CoAPCode code); CoAPCode getCode(); void setToken(byte[] token); byte[] getToken(); void setMessageId(int messageId); int getMessageId(); synchronized boolean addOptionHeader(CoAPOptionHeader option); boolean removeOptionHeader(CoAPOptionHeader option); void setPayload(byte[] payload); byte[] getPayload(); List<CoAPOptionHeader> getOptionHeaders(); List<CoAPOptionHeader> getOptionHeaders(CoAPOptionName optionName); void setOptionHeaders(List<CoAPOptionHeader> headers); int getRetransmissions(); int getTimeout(); void messageRetransmitted(); boolean messageCanceled(); void setMessageCanceled(boolean canceled); void setSocketAddress(InetSocketAddress remoteSocketAddress); InetSocketAddress getSocketAddress(); String getIdentifier(); CoAPOptionHeader getUriHostOptionHeader(); byte[] encoded(); boolean isObserveMessage(); long getMaxAge(); String logMessage(); static final String MESSAGE_ID; static final String TOKEN; static final String URI; }