2018-05-13 22:02:46 +02:00
|
|
|
package dht
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"testing"
|
2018-06-14 17:48:02 +02:00
|
|
|
|
|
|
|
"github.com/lbryio/reflector.go/dht/bits"
|
2018-05-13 22:02:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestBootstrapPing(t *testing.T) {
|
2018-06-14 17:48:02 +02:00
|
|
|
b := NewBootstrapNode(bits.Rand(), 10, bootstrapDefaultRefreshDuration)
|
2018-05-13 22:02:46 +02:00
|
|
|
|
2018-06-15 04:30:37 +02:00
|
|
|
listener, err := net.ListenPacket(Network, "127.0.0.1:54320")
|
2018-05-13 22:02:46 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2018-06-15 04:30:37 +02:00
|
|
|
err = b.Connect(listener.(*net.UDPConn))
|
|
|
|
if err != nil {
|
2018-05-30 03:38:55 +02:00
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-05-13 22:02:46 +02:00
|
|
|
|
|
|
|
b.Shutdown()
|
|
|
|
}
|