### Question:
RemotingCommand { public static byte[] markProtocolType(int source, SerializeType type) { byte[] result = new byte[4]; result[0] = type.getCode(); result[1] = (byte) ((source >> 16) & 0xFF); result[2] = (byte) ((source >> 8) & 0xFF); result[3] = (byte) (source & 0xFF); return result; } protected  RemotingCommand(); static RemotingCommand createRequestCommand(int code, CommandCustomHeader customHeader); static RemotingCommand createResponseCommand(Class<? extends CommandCustomHeader> classHeader); static RemotingCommand createResponseCommand(int code, String remark, Class<? extends CommandCustomHeader> classHeader); static RemotingCommand createResponseCommand(int code, String remark); static RemotingCommand decode(final byte[] array); static RemotingCommand decode(final ByteBuffer byteBuffer); static int getHeaderLength(int length); static SerializeType getProtocolType(int source); static int createNewRequestId(); static SerializeType getSerializeTypeConfigInThisServer(); static byte[] markProtocolType(int source, SerializeType type); void markResponseType(); CommandCustomHeader readCustomHeader(); void writeCustomHeader(CommandCustomHeader customHeader); CommandCustomHeader decodeCommandCustomHeader(Class<? extends CommandCustomHeader> classHeader); ByteBuffer encode(); void makeCustomHeaderToNet(); ByteBuffer encodeHeader(); ByteBuffer encodeHeader(final int bodyLength); void markOnewayRPC(); @JSONField(serialize = false) boolean isOnewayRPC(); int getCode(); void setCode(int code); @JSONField(serialize = false) RemotingCommandType getType(); @JSONField(serialize = false) boolean isResponseType(); LanguageCode getLanguage(); void setLanguage(LanguageCode language); int getVersion(); void setVersion(int version); int getOpaque(); void setOpaque(int opaque); int getFlag(); void setFlag(int flag); String getRemark(); void setRemark(String remark); byte[] getBody(); void setBody(byte[] body); HashMap<String, String> getExtFields(); void setExtFields(HashMap<String, String> extFields); void addExtField(String key, String value); @Override String toString(); SerializeType getSerializeTypeCurrentRPC(); void setSerializeTypeCurrentRPC(SerializeType serializeTypeCurrentRPC); static final String SERIALIZE_TYPE_PROPERTY; static final String SERIALIZE_TYPE_ENV; static final String REMOTING_VERSION_KEY; }### Answer:
@Test public void testMarkProtocolType_JSONProtocolType() { int source = 261; SerializeType type = SerializeType.JSON; byte[] result = RemotingCommand.markProtocolType(source, type); assertThat(result).isEqualTo(new byte[]{0, 0, 1, 5}); }
@Test public void testMarkProtocolType_ROCKETMQProtocolType() { int source = 16777215; SerializeType type = SerializeType.ROCKETMQ; byte[] result = RemotingCommand.markProtocolType(source, type); assertThat(result).isEqualTo(new byte[]{1, -1, -1, -1}); }