public String toString() { StringBuilder buffer = new StringBuilder(command.name() + "\n"); for (Map.Entry<String, String> entry : headers.entrySet()) { if (entry.getKey().equals(PASSCODE)) { buffer.append(entry.getKey()).append(":").append("********").append("\n"); } else { buffer.append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); } } buffer.append("\n"); if (body != null) { buffer.append(body); } buffer.append("^@"); return buffer.toString(); }
case "command": if (member.getValue() instanceof String) { obj.setCommand(io.vertx.ext.stomp.Frame.Command.valueOf((String)member.getValue()));
command = Frame.Command.valueOf(commandLine); } catch (IllegalArgumentException e) {
json.put("command", obj.getCommand().name());
/** * This method does not enforce the trailing line option. It should not be used directly, except for the PING frame. * * @return a {@link Buffer} containing the STOMP frame. It follows strictly the STOMP specification (including * header encoding). */ public Buffer toBuffer() { Buffer buffer = Buffer.buffer(command.name() + "\n"); for (Map.Entry<String, String> entry : headers.entrySet()) { buffer.appendString(encode(entry.getKey()) + ":" + encode(entry.getValue()) + "\n"); } buffer.appendString("\n"); if (body != null) { buffer.appendBuffer(body); } buffer.appendString(FrameParser.NULL); return buffer; }
/** * Checks the validity of the frame. Frames must have a valid command, and not all frames can have a body. */ public void validate() { // A frame must have a valid command if (command == null) { throw new FrameException("The frame does not have a command"); } // Spec says: Only the SEND, MESSAGE and ERROR frames MAY have a body, All other frames MUST NOT // have a body if (!COMMANDS_ACCEPTING_BODY.contains(command) && !hasEmptyBody()) { throw new FrameException("The frame " + command.name() + " cannot have a body"); } }
public void assertSubscribed() { frames.timeout(30, TimeUnit.SECONDS) .filter(frame -> frame.frame().getCommand().equals(Frame.Command.SUBSCRIBE)).take(1).timeout(720, TimeUnit.SECONDS) .toBlocking().first(); } public void assertAcked(int count) {
public void assertAcked(int count) { assertThat(frames.timeout(30, TimeUnit.SECONDS) .filter(frame -> frame.frame().getCommand().equals(Frame.Command.ACK)) .take(5, TimeUnit.SECONDS).toList().toBlocking().first().size(), is(greaterThanOrEqualTo(count))); }