added buffer implementation + useful methods
added read, write methods with closed connection support