ByteBuf buf = ctx.alloc().buffer();
buf.writeBytes(frame.command().toString().getBytes(CharsetUtil.US_ASCII));
buf.writeByte(StompConstants.LF);
try {
frame.headers().forEachEntry(new AsciiHeadersEncoder(buf, SeparatorType.COLON, NewlineType.LF));
} catch (Exception ex) {
buf.release();
PlatformDependent.throwException(ex);
}
buf.writeByte(StompConstants.LF);