StompFrameEncoder extends OneToOneEncoder { public static String escapeHeader(String headerValue) { if (headerValue == null) return null; headerValue = headerValue.replace("\\", "\\\\"); headerValue = headerValue.replace("\n", "\\n"); headerValue = headerValue.replace(":", "\\c"); return headerValue; }  static String escapeHeader(String headerValue);  }
@Test public void testEscapeHeader() throws Exception { assertEquals("test\\ntest", StompFrameEncoder.escapeHeader("test\ntest")); assertEquals("test\\ctest", StompFrameEncoder.escapeHeader("test:test")); assertEquals("test\\\\test", StompFrameEncoder.escapeHeader("test\\test")); assertEquals("test\\cline1\\nline2 \\\\b\\\\", StompFrameEncoder.escapeHeader("test:line1\nline2 \\b\\")); }
@Test public void testEscapeHeader_null() throws Exception { assertNull(StompFrameEncoder.escapeHeader(null)); }