shutdown socket gracefully with SocketDrainer

Previous implementation does not actually drain socket before
closing it. The new SocketDrainer class will read all the data
from the socket and then close it.

Change-Id: Ia9d47051bdb02ce5b24ebd836df7fdcf51d647fe
Merge "shutdown socket gracefully with SocketDrainer" into idea133