require 'socket'

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

require 'net/http'
require 'net/ftp'

class Net::HTTP
  Socket = ::Socket
end

class Net::FTP
  Socket = ::Socket
end

Use a safer method of fixing Net::HTTP and Net::FTP, as suggested by @wilkie.
Use a safer method of fixing Net::HTTP and Net::FTP, as suggested by @wilkie.
