module Async::HTTP::Protocol::HTTPS

def self.client(stream)

def self.client(stream)
	protocol_for(stream).client(stream)
end

def self.names

Supported Application Layer Protocol Negotiation names:
def self.names
	HANDLERS.keys.compact
end

def self.protocol_for(stream)

def self.protocol_for(stream)
	# alpn_protocol is only available if openssl v1.0.2+
	name = stream.io.alpn_protocol
	
	Async.logger.debug(self) {"Negotiating protocol #{name.inspect}..."}
	
	if protocol = HANDLERS[name]
		return protocol
	else
		throw ArgumentError.new("Could not determine protocol for connection (#{name.inspect}).")
	end
end

def self.server(stream)

def self.server(stream)
	protocol_for(stream).server(stream)
end