add connection class

 * it sends messages via the corresponding socket
 * it sends messages only when waken up on the network thread
 * it returns messages from the network