class Async::HTTP::WebMockEndpoint
Attributes
Public Class Methods
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 133 def initialize(scheme, authority, protocol) @scheme = scheme @authority = authority @protocol = protocol end
Public Instance Methods
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 141 def connect server_socket, client_socket = create_connected_sockets Async(transient: true) do accept_socket(server_socket) end client_socket end
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 149 def inspect "\#<#{self.class}> #{scheme}://#{authority} protocol=#{protocol}" end
Private Instance Methods
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 177 def accept_socket(socket) server = Async::HTTP::Server.new(WebMockApplication, self) server.accept(socket, socket.remote_address) end
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 169 def alpn_protocol nil # means HTTP11 will be used for HTTPS end
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 159 def create_connected_sockets pair = begin socket_class.pair(Socket::AF_UNIX, Socket::SOCK_STREAM) rescue Errno::EAFNOSUPPORT socket_class.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
Source
# File lib/webmock/http_lib_adapters/async_http_client_adapter.rb, line 155 def socket_class defined?(Async::IO::Socket) ? Async::IO::Socket : Socket end