Skip to content

Commit

Permalink
Add case for TestNewServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Jun 11, 2019
1 parent bc2d652 commit 906e2e2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/dmsg/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"testing"
"time"

"github.com/skycoin/skywire/internal/noise"

"golang.org/x/net/nettest"

"github.com/skycoin/skycoin/src/util/logging"
Expand Down Expand Up @@ -145,7 +147,12 @@ func TestNewServer(t *testing.T) {
l, err := net.Listen("tcp", "")
require.NoError(t, err)

s, err := NewServer(sPK, sSK, l, dc)
// must fail on already wrapped listener
wrappedL := noise.WrapListener(l, sPK, sSK, false, noise.HandshakeXK)
s, err := NewServer(sPK, sSK, wrappedL, dc)
require.Equal(t, ErrListenerAlreadyWrappedToNoise, err)

s, err = NewServer(sPK, sSK, l, dc)
require.NoError(t, err)

go s.Serve() //nolint:errcheck
Expand Down

0 comments on commit 906e2e2

Please sign in to comment.