class IO::Endpoint::CompositeEndpoint

def bind(&block)

def bind(&block)
	if block_given?
		@endpoints.each do |endpoint|
			endpoint.bind(&block)
		end
	else
		@endpoints.map(&:bind).flatten.compact
	end
end

def connect(&block)

def connect(&block)
	last_error = nil
	
	@endpoints.each do |endpoint|
		begin
			return endpoint.connect(&block)
		rescue => last_error
		end
	end
	
	raise last_error
end

def each(&block)

def each(&block)
	@endpoints.each do |endpoint|
		endpoint.each(&block)
	end
end

def initialize(endpoints, **options)

def initialize(endpoints, **options)
	super(**options)
	@endpoints = endpoints
end