Thanks for posting your question in the Microsoft Q&A forum.
Cause:
This can occur if proxy settings are configured incorrectly. For example, this can occur proxy settings do not allow access to the endpoints that are used by Microsoft 365.
Resolution:
- Configure the settings on the proxy server to allow access to the endpoints that are used by the service. For a list of IP addresses and URLs that are used by Microsoft Exchange Online, see the Exchange Online section of Microsoft 365 URLs and IP addresses.
- Make sure that proxy settings are configured correctly on the Exchange servers in your environment by doing the following:
- Set the proxy in Internet Explorer.
- Set the proxy by using the netsh command-line tool. For more information, see Netsh Commands in for Windows Hypertext Transfer Protocol.
- Set the proxy by using the cmdlet. For example, run the following command:
Set-ExchangeServer
Set-ExchangeServer NameOfServer -InternetWebProxy Http://proxyURL:Port
3.Rerun the Hybrid Configuration wizard.
You can refer to this link for details:https://learn.microsoft.com/en-us/exchange/troubleshoot/hybrid-configuration-wizard-errors/the-underlying-connection-was-closed-error?source=recommendations
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.