 +    protected function newResponse(array $headers, $body= '') {
 +      return new HttpResponse(new MemoryInputStream(implode("\r\n", $headers)."\r\n\r\n".$body));
 +    }
-+  
-+    /**
-+     * Test empty response
++
++    /**
++     * Test non-empty response
 +     *
 +     */
 +    #[@test]
-+    public function getEmptyDocument() {
-+      $response= $this->newResponse(array('HTTP/1.0 200 OK', 'Content-Length: 0'));
-+      $this->assertEquals(200, $response->getStatusCode());
-+      $this->assertEquals('0', $response->getHeader('Content-Length'));
-+    }
-+
-+    /**
-+     * Test non-empty response
-+     *
-+     */
-+    #[@test]
-+    public function getDocument() {
++    public function errorDocument() {
 +      $body= '<h1>File not found</h1>';
 +      $response= $this->newResponse(array('HTTP/1.0 404 OK', 'Content-Length: 23', 'Content-Type: text/html'), $body);
 +      $this->assertEquals(404, $response->getStatusCode());

+    }
+
+    /**
+     * Test what happens when the server responds with an incorrect protocol
+     *
+     */

+      $this->assertEquals('text/html', $response->getHeader('Content-Type'));
+      $this->assertEquals($body, $response->readData());
+    }
+  
+    /**
+     * Test empty response
+     *
+     */
+    #[@test]
+    public function emptyDocument() {
+      $response= $this->newResponse(array('HTTP/1.0 204 No content'));
+      $this->assertEquals(204, $response->getStatusCode());
+    }
+
+    /**
+     * Test chunked transfer-encoding
+     *
+     */
+    #[@test]
+    public function chunkedDocument() {
+      $body= '<h1>File not found</h1>';
+      $response= $this->newResponse(array('HTTP/1.0 404 OK', 'Transfer-Encoding: chunked'), "17\r\n".$body."\r\n0\r\n");
+      $this->assertEquals(404, $response->getStatusCode());
