protected List<String> getHeaderBodyText(String type, List<String> text)
    {
        List<String> resultTextList = new ArrayList<String>();
        boolean foundNonHeaderLine = false;
        int currentIndex = 0;
        String currentLine;
        while (currentIndex < text.size()
                && ((type.equals(GET_HEADERS) && !foundNonHeaderLine) || type.equals(GET_BODY)))
        {
            currentLine = text.get(currentIndex);
            currentIndex++;
            // once we start the body part of the text everything else is considered part of the body
            if (!foundNonHeaderLine) {
                foundNonHeaderLine = containsNonHeaderText(currentLine);
            }

            if (type.equals(GET_HEADERS) && !foundNonHeaderLine)
            {
                resultTextList.add(currentLine);
            } else if (type.equals(GET_BODY) && foundNonHeaderLine)
            {
                resultTextList.add(currentLine);
            }
        }
        return resultTextList;
    }