File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ spec = do
40
40
{ addrFlags = [AI_PASSIVE ]
41
41
, addrSocketType = Stream
42
42
}
43
+ it " successfully binds to an ipv4 socket" $ do
44
+ addr: _ <- getAddrInfo (Just hints) (Just serverAddr) Nothing
45
+ sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)
46
+ bind sock $ addrAddress addr
47
+
48
+ it " fails to bind to unknown ipv4 socket" $ do
49
+ addr: _ <- getAddrInfo (Just hints) (Just " 127.0.0.3" ) Nothing
50
+ sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)
51
+ bind sock (addrAddress addr) `shouldThrow` anyIOException
52
+
43
53
it " successfully binds to an ipv6 socket" $ do
44
54
addr: _ <- getAddrInfo (Just hints) (Just serverAddr6) Nothing
45
55
sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)
You can’t perform that action at this time.
0 commit comments