All Downloads are FREE. Search and download functionalities are using the official Maven repository.

androidMain.aws.sdk.kotlin.crt.http.HttpClientConnectionJVM.kt Maven / Gradle / Ivy

There is a newer version: 0.8.9
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

package aws.sdk.kotlin.crt.http

import software.amazon.awssdk.crt.http.HttpClientConnection as HttpClientConnectionJni

/**
 * Wrapper around JNI HttpClientConnection type that implements the expected KMP interface
 */
internal class HttpClientConnectionJVM constructor(internal val jniConn: HttpClientConnectionJni) : HttpClientConnection {
    override val id: String = jniConn.nativeHandle.toString()

    override fun makeRequest(httpReq: HttpRequest, handler: HttpStreamResponseHandler): HttpStream {
        val jniStream = jniConn.makeRequest(httpReq.into(), handler.asJniStreamResponseHandler())
        return HttpStreamJVM(jniStream)
    }

    override fun close() = jniConn.close()

    override fun shutdown() = jniConn.shutdown()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy