example of non-blocking socket encapsulation