def METHOD_NAME(mocker, protocol, port_generator):
    random_port = port_generator()
    on_always_mock = mocker.Mock()
    on_error_mock = mocker.Mock()
    on_done_mock = mocker.Mock()
    client = Client(host=f'{protocol}://localhost:{random_port}')
    def _request(stream_param=True):
        client.post(
            '/',
            random_docs(1),
            request_size=1,
            max_attempts=5,
            on_always=on_always_mock,
            on_error=on_error_mock,
            on_done=on_done_mock,
            return_responses=True,
            timeout=0.5,
            stream=stream_param,
        )
    if protocol == 'grpc':
        stream_opts = [True, False]
        for stream_param in stream_opts:
            with pytest.raises(ConnectionError):
                _request(stream_param)
    else:
        with pytest.raises(ConnectionError):
            _request()