It sounds like there is some connection issue between your machine and the OAuth server. I assume you can open https://duplicati-oauth-handler.appspot.com in a browser from the same machine.
There is this issue, which indicates that sometimes the connections fail, but I am not sure it is related to your issue, as you get no reply (timeout):
opened 01:42PM - 23 Oct 17 UTC
bug
- [x] I have searched open and closed issues for duplicates.
----------------… ------------------------
## Environment info
- **Duplicati version**: 2.0.2.1
- **Operating system**: Windows 7
- **Backend**: WEBDAV
## Description
Test connection does not work for WEBDAV on windows 7 and running backups fails
## Steps to reproduce
1. Install Windows 7, duplicati 2.0.2.1
2. Try to add a new WEBDAV backup
3. Press `test connection`
- **Actual result**:
Error pops up: `Failed to connect: The underlying connection was closed: An unexpected error occurred on a send.`
- **Expected result**:
Connection test is successful/user is prompted whether to create folder
## Screenshots
![ocetfdz](https://user-images.githubusercontent.com/9987548/31891771-09b747dc-b810-11e7-9def-711e0dcef6b4.png)
## Debug log
```
Oct 23, 2017 4:34 PM: Reporting error gave error
System.ObjectDisposedException: Cannot write to a closed TextWriter. at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at Duplicati.Server.WebServer.RESTHandler.DoProcess(RequestInfo info, String method, String module, String key)
Oct 23, 2017 4:34 PM: Request for http://localhost:8200/api/v1/remoteoperation/test gave error
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.InvalidOperationException: This operation cannot be performed on a completed asynchronous result object. at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- End of inner exception stack trace --- at Duplicati.Library.Utility.AsyncHttpRequest.AsyncWrapper.GetResponseOrStream() at Duplicati.Library.Utility.AsyncHttpRequest.GetResponse() at Duplicati.Library.Backend.WEBDAV.List() at Duplicati.Server.WebServer.RESTMethods.RemoteOperation.TestConnection(String url, RequestInfo info) at Duplicati.Server.WebServer.RESTMethods.RemoteOperation.POST(String key, RequestInfo info) at Duplicati.Server.WebServer.RESTHandler.DoProcess(RequestInfo info, String method, String module, String key)
```
NOTE:
reverting `AsyncHttpRequest.cs` to 0c68daff6c2204808c37a79ea4abd2a84f35f79c fixed the issue for me.