001package io.prometheus.metrics.exporter.pushgateway;
002
003import io.prometheus.metrics.annotations.StableApi;
004import java.io.IOException;
005import java.net.HttpURLConnection;
006import java.net.URL;
007
008/**
009 * This can be used for creating {@link Scheme#HTTP} and {@link Scheme#HTTPS} connections.
010 *
011 * <p>However, if you want to use it with {@link Scheme#HTTPS} you must make sure that the keychain
012 * for verifying the server certificate is set up correctly. For an example of how to skip
013 * certificate verification see {@code PushGatewayTestApp} in {@code
014 * integration-tests/it-pushgateway/}.
015 */
016@StableApi
017public class DefaultHttpConnectionFactory implements HttpConnectionFactory {
018  @Override
019  public HttpURLConnection create(URL url) throws IOException {
020    return (HttpURLConnection) url.openConnection();
021  }
022}