Hi everyone,
Is it possible to retrieve the hostname from an already constructed channel, i.e. a `ChannelInterface`?
The reason is this:
I have a client abstraction class that gets passed a `ChannelInterface` at construction time. For unit testing, I will provide it with an in-process channel.
This client also checks the connection status by creating a `NotifyOnStateChange` task on the completion queue. This is important for "real" channels, but since an in-process channel is always connected, it does not really make sense there. However, since I cannot check how this channel was actually constructed, I always do it. My unit test log is then full of messages like
grpc_channel_check_connectivity_state called on something that is not a client channel, but 'connected'
I understand that the hostname for a local channel is `inproc`, but there are no means to query it afterwards. If there were, I would be able to check it before creating the task on the task queue.
Would it make sense to add this to the interface? I imagine something like:
virtual grpc::string ChannelInterface::GetHost() const = 0;
Kind regards,
Norman