Socket encapsulation