2014-03-16 15:31:06 +00:00
|
|
|
package tracker
|
|
|
|
|
|
|
|
import (
|
2017-11-07 18:14:13 +00:00
|
|
|
"crypto/tls"
|
|
|
|
"net"
|
|
|
|
"net/http"
|
2014-03-16 15:31:06 +00:00
|
|
|
"testing"
|
2017-11-07 18:14:13 +00:00
|
|
|
"time"
|
2014-03-16 15:31:06 +00:00
|
|
|
)
|
|
|
|
|
2017-11-07 18:14:13 +00:00
|
|
|
var defaultClient = &http.Client{
|
|
|
|
Timeout: time.Second * 15,
|
|
|
|
Transport: &http.Transport{
|
|
|
|
Dial: (&net.Dialer{
|
|
|
|
Timeout: 15 * time.Second,
|
|
|
|
}).Dial,
|
|
|
|
TLSHandshakeTimeout: 15 * time.Second,
|
|
|
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2014-03-16 15:31:06 +00:00
|
|
|
func TestUnsupportedTrackerScheme(t *testing.T) {
|
2015-10-04 08:58:23 +00:00
|
|
|
t.Parallel()
|
2017-12-28 08:47:51 +00:00
|
|
|
_, err := Announce(defaultClient, defaultHTTPUserAgent, "lol://tracker.openbittorrent.com:80/announce", nil)
|
2014-03-16 15:31:06 +00:00
|
|
|
if err != ErrBadScheme {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|