class Async::HTTP::WebMockEndpoint
Attributes
scheme[RW]
Public Class Methods
new(scheme, authority, protocol)
click to toggle source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 131 def initialize(scheme, authority, protocol) @scheme = scheme @authority = authority @protocol = protocol end
Public Instance Methods
connect()
click to toggle source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 139 def connect server_socket, client_socket = create_connected_sockets Async(transient: true) do accept_socket(server_socket) end client_socket end
inspect()
click to toggle source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 147 def inspect "\#<#{self.class}> #{scheme}://#{authority} protocol=#{protocol}" end
Private Instance Methods
accept_socket(socket)
click to toggle source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 171 def accept_socket(socket) server = Async::HTTP::Server.new(WebMockApplication, self) server.accept(socket, socket.remote_address) end
alpn_protocol()
click to toggle source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 163 def alpn_protocol nil # means HTTP11 will be used for HTTPS end
create_connected_sockets()
click to toggle source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 153 def create_connected_sockets pair = begin Async::IO::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM) rescue Errno::EAFNOSUPPORT Async::IO::Socket.pair(Socket::AF_INET, Socket::SOCK_STREAM) end pair.tap do |sockets| sockets.each do |socket| socket.instance_variable_set :@alpn_protocol, nil socket.instance_eval do def alpn_protocol nil # means HTTP11 will be used for HTTPS end end end end end