         }
         outputStream = nil
         inputStream = nil
-    }
-    
+        fragBuffer = nil
+    }
+
     /**
      Handles the incoming bytes and sending them to the proper processing method.
      */

        details[NSLocalizedDescriptionKey] =  detail
        return NSError(domain: WebSocket.ErrorDomain, code: Int(code), userInfo: details)
    }
    
    /**
     Write an error to the socket
     */

                }
                _ = processResponse(response)
            }

            let step = Int(offset + numericCast(len))
            return buffer.fromOffset(step)
        }
    }

    /**
     Process all messages in the buffer if possible.
     */
