Description
Problem:
The hyper client isn't currently capable of shutting down gracefully, so the hyper test server added in #4838 ignores socket NotConnected errors to workaround this. See #4855.
Ideally, this exception for NotConnected errors would be more specific to shutdown. For instance, we wouldn't want to ignore a NotConnected error that occurred during a read. However, the ability to determine if an error occurred at shutdown isn't currently possible. Hyper has a Kind::Shutdown enum value that's associated with the NotConnected error. However, it's not currently possible to access this value with the public APIs.
Hyper provides APIs to check the error kind, such as is_canceled(). A new is_shutdown()
API should likely be added for this use case.
Solution:
After this information is accessible from the hyper error, the NotConnected exception should be updated to ensure that the NotConnected error occurred during a shutdown.