Adds Socket::transform and Socket::restore.