<?php

declare (strict_types=1);
namespace GDAVSCOPE\Amp\Http\Client\Connection;

use GDAVSCOPE\Amp\Cancellation;
use GDAVSCOPE\Amp\Http\Client\DelegateHttpClient;
use GDAVSCOPE\Amp\Http\Client\Request;
use GDAVSCOPE\Amp\Http\Client\Response;
use GDAVSCOPE\Amp\Socket\SocketAddress;
use GDAVSCOPE\Amp\Socket\TlsInfo;
interface Stream extends DelegateHttpClient
{
    /**
     * Executes the request.
     *
     * This method may only be invoked once per instance.
     *
     * The implementation must ensure that events are called on {@see events()} and may use {@see request()} for that.
     *
     * @throws \Error Thrown if this method is called more than once.
     */
    public function request(Request $request, Cancellation $cancellation): Response;
    public function getLocalAddress(): SocketAddress;
    public function getRemoteAddress(): SocketAddress;
    public function getTlsInfo(): ?TlsInfo;
}
