001/*
002 * Copyright 2016 The AppAuth for Android Authors. All Rights Reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005 * in compliance with the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the
010 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
011 * express or implied. See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014
015package net.openid.appauth.connectivity;
016
017import android.net.Uri;
018import androidx.annotation.NonNull;
019
020import java.io.IOException;
021import java.net.HttpURLConnection;
022
023/**
024 * Creates {@link java.net.HttpURLConnection} instances for use in direct interactions
025 * with the authorization service, i.e. those not performed via a browser.
026 */
027public interface ConnectionBuilder {
028
029    /**
030     * Creates a connection to the specified URL.
031     * @throws IOException if an error occurs while attempting to establish the connection.
032     */
033    @NonNull
034    HttpURLConnection openConnection(@NonNull Uri uri) throws IOException;
035}