         context.write(self.wrapOutboundOut(.body(.byteBuffer(self.plaintextBuffer))), promise: nil)
     }
 
-    private func processJSON(context: ChannelHandlerContext) {
+    private func processJSON(context: ChannelHandlerContext) throws {
         let responseHead = self.responseHead(contentType: "application/json", contentLength: Constants.jsonResponseLengthString)
         context.write(self.wrapOutboundOut(.head(responseHead)), promise: nil)
+        self.jsonBuffer.clear()
+        try self.jsonBuffer.writeBytes(self.jsonEncoder.encode(JSONTestResponse()))
         context.write(self.wrapOutboundOut(.body(.byteBuffer(self.jsonBuffer))), promise: nil)
     }
 

    static let plainTextResponseLength = plainTextResponse.utf8CodeUnitCount
    static let plainTextResponseLengthString = String(plainTextResponseLength)

    static let jsonResponse = try! JSONEncoder().encode(JSONTestResponse())
    static let jsonResponseLength = try! JSONEncoder().encode(JSONTestResponse()).count
    static let jsonResponseLengthString = String(jsonResponseLength)
}

    public typealias InboundIn = HTTPServerRequestPart
    public typealias OutboundOut = HTTPServerResponsePart

    let jsonEncoder: JSONEncoder
    let dateCache: RFC1123DateCache

    var plaintextBuffer: ByteBuffer
    var jsonBuffer: ByteBuffer

