@Test
public void testHEFormatting() throws Exception {

    final NameValuePair param1 = new BasicNameValuePair("param", "regular_stuff");
    final NameValuePair param2 = new BasicNameValuePair("param", "this\\that");
    final NameValuePair param3 = new BasicNameValuePair("param", "this,that");
    final NameValuePair param4 = new BasicNameValuePair("param", null);
    final NameValuePair[] params = new NameValuePair[] {param1, param2, param3, param4};
    final HeaderElement element = new BasicHeaderElement("name", "value", params);
    final CharArrayBuffer buf = new CharArrayBuffer(64);
    this.formatter.formatHeaderElement(buf, element, false);
    Assert.assertEquals("name=value; param=regular_stuff; param=\"this\\\\that\"; param=\"this,that\"; param",
            buf.toString());
}