Interface ApiKeyCredential.HttpConnectionFactory

Enclosing class:
ApiKeyCredential
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface ApiKeyCredential.HttpConnectionFactory
Opens the HTTP connection used for an API key exchange.

Implement this interface to configure a proxy or supply a connection in tests. The credential sets its timeout, method, headers, and request body, then disconnects it after the exchange. For example, uri -> (HttpURLConnection) uri.toURL().openConnection(proxy) uses an application-selected proxy.

  • Method Summary

    Modifier and Type
    Method
    Description
    openConnection(URI tokenUrl)
    Opens an unconnected HTTP connection to the validated token URL.
  • Method Details

    • openConnection

      HttpURLConnection openConnection(URI tokenUrl) throws IOException
      Opens an unconnected HTTP connection to the validated token URL.
      Parameters:
      tokenUrl - the HTTPS token URL, or a permitted loopback HTTP URL
      Returns:
      an unconnected HTTP connection owned by the credential for this exchange
      Throws:
      IOException - if a connection cannot be created