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