def obtain_socket(uri)
      socket = TCPSocket.new(uri.host, uri.port || socket_port(uri))

      if secure_uri?(uri)
        ctx = OpenSSL::SSL::SSLContext.new

        if ENV['DISCORDRB_SSL_VERIFY_NONE']
          ctx.ssl_version = 'SSLv23'
          ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE # use VERIFY_PEER for verification

          cert_store = OpenSSL::X509::Store.new
          cert_store.set_default_paths
          ctx.cert_store = cert_store
        else
          ctx.set_params ssl_version: :TLSv1_2
        end

        socket = OpenSSL::SSL::SSLSocket.new(socket, ctx)
        socket.connect
      end

      socket
    end
def obtain_socket(uri)
      socket = TCPSocket.new(uri.host, uri.port || socket_port(uri))

      if secure_uri?(uri)
        ctx = OpenSSL::SSL::SSLContext.new

        if ENV['DISCORDRB_SSL_VERIFY_NONE']
          ctx.ssl_version = 'SSLv23'
          ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE # use VERIFY_PEER for verification

          cert_store = OpenSSL::X509::Store.new
          cert_store.set_default_paths
          ctx.cert_store = cert_store
        else
          ctx.set_params ssl_version: :TLSv1_2
        end

        socket = OpenSSL::SSL::SSLSocket.new(socket, ctx)
        socket.connect
      end

      socket
    end
Create and connect a socket using a URI