feat: implement http support
Signed-off-by: Kairee Wu <kaireewu@gmail.com>
This commit is contained in:
@ -2,6 +2,8 @@ package krpc
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@ -36,5 +38,24 @@ func TestClient_dialTimeout(t *testing.T) {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestXDial(t *testing.T) {
|
||||
if runtime.GOOS == "linux" {
|
||||
ch := make(chan struct{})
|
||||
addr := "/tmp/krpc.sock"
|
||||
|
||||
go func() {
|
||||
_ = os.Remove(addr)
|
||||
l, err := net.Listen("unix", addr)
|
||||
if err != nil {
|
||||
t.Fatal("failed to listen unix socket")
|
||||
}
|
||||
ch <- struct{}{}
|
||||
Accept(l)
|
||||
}()
|
||||
<-ch
|
||||
_, err := XDial("unix://"+addr)
|
||||
_assert(err == nil, "failed to connect unix socket")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user