public void testParsingInvalidHeaders() throws Exception {
String s = " stuff\r\n" +
"header1: stuff\r\n" +
"\r\n";
HttpDataReceiver receiver = new HttpDataReceiverMockup(s, "US-ASCII");
try {
HeaderUtils.parseHeaders(receiver);
fail("ProtocolException should have been thrown");
} catch (ProtocolException ex) {
// expected
}
s = " : stuff\r\n" +
"header1: stuff\r\n" +
"\r\n";
receiver = new HttpDataReceiverMockup(s, "US-ASCII");
try {
HeaderUtils.parseHeaders(receiver);
fail("ProtocolException should have been thrown");
} catch (ProtocolException ex) {
// expected