protected function buildHeaders($headers)
    {
        $parts = explode("\r\n", $headers);
        $status = array_shift($parts);
        $statusParts = explode(' ', $status);

        if (array_key_exists(0, $statusParts)) {
            $this->setProtocol($statusParts[0]);
        }

        if (array_key_exists(1, $statusParts)) {
            $this->setStatusCode($statusParts[1]);
        }

        foreach ($parts as $header) {
            list($header, $value)   = explode(':', $header, 2);
            $header                 = trim($header, ' ');

            if (isset($this->headers[$header])) {
                $this->headers[$header] .= "," . $value;
            } else {
                $this->headers[$header] = trim($value, ' ');
            }
        }
    }