protected static Map<String, String> parsePostHeaders(InputStream in) throws IOException {
        Map<String, String> headerMap = new HashMap<String, String>(4);
        String line;
        while (true) {
            line = readLine(in);
            if (line == null || line.length() == 0) {
                // empty line
                return headerMap;
            }
            int index = line.indexOf(":");
            if (index < 1) {
                // empty value, abandon
                continue;
            }
            String headerName = line.substring(0, index).trim().toLowerCase();
            String headerValue = line.substring(index + 1).trim();
            if (headerValue.length() > 0) {
                headerMap.put(headerName, headerValue);
            }
        }
    }
@Test
    public void parsePostHeaders() throws IOException {
        Map<String, String> map;
        
        map = HttpEventTask.parsePostHeaders(new ByteArrayInputStream("".getBytes()));
        assertTrue(map.size() == 0);
        
        map = HttpEventTask.parsePostHeaders(new ByteArrayInputStream("Content-type:  test \r\n\r\nbody".getBytes()));
        assertEquals("test", map.get("content-type"));
        
        map = HttpEventTask.parsePostHeaders(new ByteArrayInputStream("Content-Encoding: utf-8\r\n\r\nbody".getBytes()));
        assertEquals("utf-8", map.get("content-encoding"));
    }