import ssl
from _typeshed import Incomplete

log: Incomplete
DEFAULT_KAFKA_PORT: int
ssl_available: bool
SSLEOFError = ssl.SSLEOFError
SSLWantReadError = ssl.SSLWantReadError
SSLWantWriteError = ssl.SSLWantWriteError
SSLZeroReturnError = ssl.SSLZeroReturnError

AFI_NAMES: Incomplete

class ConnectionStates:
    DISCONNECTED: str
    CONNECTING: str
    HANDSHAKE: str
    CONNECTED: str
    AUTHENTICATING: str
    API_VERSIONS_SEND: str
    API_VERSIONS_RECV: str

class BrokerConnection:
    DEFAULT_CONFIG: Incomplete
    SECURITY_PROTOCOLS: Incomplete
    VERSION_CHECKS: Incomplete
    host: Incomplete
    port: Incomplete
    afi: Incomplete
    config: Incomplete
    node_id: Incomplete
    in_flight_requests: Incomplete
    state: Incomplete
    last_attempt: int
    def __init__(self, host, port, afi, **configs) -> None: ...
    def connect_blocking(self, timeout=...): ...
    def connect(self): ...
    def blacked_out(self): ...
    def throttled(self): ...
    def throttle_delay(self): ...
    def connection_delay(self): ...
    def connected(self): ...
    def connecting(self): ...
    def initializing(self): ...
    def disconnected(self): ...
    def connect_failed(self): ...
    def __del__(self) -> None: ...
    def close(self, error=None) -> None: ...
    def send(self, request, blocking: bool = True, request_timeout_ms=None): ...
    def send_pending_requests(self): ...
    def send_pending_requests_v2(self): ...
    def can_send_more(self): ...
    def recv(self): ...
    def requests_timed_out(self): ...
    def timed_out_ifrs(self): ...
    def next_ifr_request_timeout_ms(self): ...
    def get_api_versions(self): ...
    def check_version(self, timeout: int = 2, **kwargs): ...

class BrokerConnectionMetrics:
    metrics: Incomplete
    bytes_sent: Incomplete
    bytes_received: Incomplete
    request_time: Incomplete
    throttle_time: Incomplete
    def __init__(self, metrics, metric_group_prefix, node_id) -> None: ...

def get_ip_port_afi(host_and_port_str): ...
def is_inet_4_or_6(gai): ...
def dns_lookup(host, port, afi=...): ...
