class IO::Endpoint::SSLEndpoint

def connect(&block)

Returns:
  • (Socket) - the connected socket

Other tags:
    Yield: - the socket which is being connected
def connect(&block)
	socket = ::OpenSSL::SSL::SSLSocket.new(@endpoint.connect, self.context)
	
	if hostname = self.hostname
		socket.hostname = hostname
	end
	
	begin
		socket.connect
	rescue
		socket.close
		raise
	end
	
	return socket unless block_given?
		
	begin
		yield socket
	ensure
		socket.close
	end
end