Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p-quic-transport
Commits
0b44affe
Unverified
Commit
0b44affe
authored
Mar 18, 2017
by
Marten Seemann
Browse files
add tests for transport.Listen
parent
46ad9d04
Changes
1
Hide whitespace changes
Inline
Side-by-side
transport_test.go
View file @
0b44affe
...
...
@@ -14,6 +14,28 @@ var _ = Describe("Transport", func() {
t
=
NewQuicTransport
(
nil
)
})
Context
(
"listening"
,
func
()
{
It
(
"creates a new listener"
,
func
()
{
maddr
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/127.0.0.1/udp/1234/quic"
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
ln
,
err
:=
t
.
Listen
(
maddr
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
Expect
(
ln
.
Multiaddr
())
.
To
(
Equal
(
maddr
))
})
It
(
"returns an existing listener"
,
func
()
{
maddr
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/127.0.0.1/udp/1235/quic"
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
ln
,
err
:=
t
.
Listen
(
maddr
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
Expect
(
ln
.
Multiaddr
())
.
To
(
Equal
(
maddr
))
ln2
,
err
:=
t
.
Listen
(
maddr
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
Expect
(
ln2
)
.
To
(
Equal
(
ln
))
Expect
(
t
.
listeners
)
.
To
(
HaveLen
(
1
))
})
})
It
(
"matches"
,
func
()
{
invalidAddr
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/127.0.0.1/udp/1234"
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment