Added Stream.shutdown API

shutdown() flushes the write side of the stream, while close() abruptly
terminate the connection. The proper way to terminate a connection while
flushing the pending data is to call shutdown() and then close().