buffet: Switch XmppChannel to use asynchronous socket streams

Changed XmppClient from using raw socket file descriptors to
chromeos::Stream in preparation of adding TLS support (via subsituting
the regular socket-based FileStream with TlsStream once TLS handshake
is initiated by the XMPP server).

Also implemented exponential backoff for reconnecting to the server
in case of a network error as well as more comprehensive network
read/write mechanism which will tie better into more strict XML-based
parser/communication and renamed XmppClient to XmppChannel after
adding a generic interface for NotificationChannel and NotificationDelegate
which will help us implement other notification channels such as
GCM and periodic polling.

BUG=brillo:458
TEST=`FEATURES=test emerge-link buffet`
     Tested XMPP operation on DUT.

Change-Id: I88d593692ca56d03356155e12cde2f2942f8391e
Reviewed-on: https://chromium-review.googlesource.com/271151
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Nathan Bullock <nathanbullock@google.com>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/utils.h b/buffet/utils.h
index 32738d2..0325171 100644
--- a/buffet/utils.h
+++ b/buffet/utils.h
@@ -37,6 +37,11 @@
 std::unique_ptr<const base::DictionaryValue> LoadJsonDict(
     const std::string& json_string, chromeos::ErrorPtr* error);
 
+// Synchronously resolves the |host| and connects a socket to the resolved
+// address/port.
+// Returns the connected socket file descriptor or -1 if failed.
+int ConnectSocket(const std::string& host, uint16_t port);
+
 }  // namespace buffet
 
 #endif  // BUFFET_UTILS_H_