def METHOD_NAME(reactor):
    certData = FilePath("server-cert.pem").getContent()
    serverCertificate = ssl.Certificate.loadPEM(certData)
    options = ssl.optionsForClientTLS(
        hostname=TARGET_HOST,
        trustRoot=serverCertificate,
        # `acceptableProtocols` is the targeted option for this example.
        acceptableProtocols=ACCEPTABLE_PROTOCOLS,
    )
    class BasicH2Request(protocol.Protocol):
        def connectionMade(self):
            print("Connection made")
            # Add a deferred that fires where we're done with the connection.
            # This deferred is returned to the reactor, and when we call it
            # back the reactor will clean up the protocol.
            self.complete = defer.Deferred()
            # Write some data to trigger the SSL handshake.
            self.transport.write(TLS_TRIGGER_DATA)
        def dataReceived(self, data):
            # We can only safely be sure what the next protocol is when we know
            # the TLS handshake is over. This is generally *not* in the call to
            # connectionMade, but instead only when we've received some data
            # back.
            print(f"Next protocol is: {self.transport.negotiatedProtocol}")
            self.transport.loseConnection()
            # If this is the first data write, we can tell the reactor we're
            # done here by firing the callback we gave it.
            if self.complete is not None:
                self.complete.callback(None)
                self.complete = None
        def connectionLost(self, reason):
            # If we haven't received any data, an error occurred. Otherwise,
            # we lost the connection on purpose.
            if self.complete is not None:
                print(f"Connection lost due to error {reason}")
                self.complete.callback(None)
            else:
                print("Connection closed cleanly")
    return endpoints.connectProtocol(
        endpoints.SSL4ClientEndpoint(reactor, TARGET_HOST, TARGET_PORT, options),
        BasicH2Request(),
    ).addCallback(lambda protocol: protocol.complete)