Switch to new Streams API.

The following changes were made:

* Let Terminal implement stream.Duplex.

* Instead of shimming the this.socket, the API forwards the read/write commands to the socket.
  This has the benefit that the pipe event of a foreign writer will get Terminal instance
  instead of the socket instance.