```ruby
require 'socket'

module Net::Socket
  ::Socket.constants.each do |name|
    const_set(name, ::Socket.const_get(name))
  end
end
```

Use a safer method of fixing Net::HTTP and Net::FTP, as suggested by @wilkie.
user
```ruby
require 'net/http'
require 'net/ftp'

class Net::HTTP
  Socket = ::Socket
end

class Net::FTP
  Socket = ::Socket
end
```
assistant