github.com/hyperledger/aries-framework-go@v0.3.2/pkg/framework/aries/defaults/defaults_test.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package defaults
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/stretchr/testify/require"
    13  
    14  	"github.com/hyperledger/aries-framework-go/pkg/framework/aries"
    15  )
    16  
    17  func TestWithInboundHTTPPort(t *testing.T) {
    18  	t.Run("test inbound with http port - success", func(t *testing.T) {
    19  		a, err := aries.New(WithInboundHTTPAddr(":26503", "", "", ""))
    20  		require.NoError(t, err)
    21  		require.NoError(t, a.Close())
    22  	})
    23  
    24  	t.Run("test inbound with http port - empty address", func(t *testing.T) {
    25  		_, err := aries.New(WithInboundHTTPAddr("", "", "", ""))
    26  		require.Error(t, err)
    27  		require.Contains(t, err.Error(), "http inbound transport initialization failed")
    28  	})
    29  }
    30  
    31  func TestWithInboundWSPort(t *testing.T) {
    32  	t.Run("test inbound with ws port - success", func(t *testing.T) {
    33  		a, err := aries.New(WithInboundWSAddr(":26503", "", "", "", 0))
    34  		require.NoError(t, err)
    35  		require.NoError(t, a.Close())
    36  	})
    37  
    38  	t.Run("test inbound with ws port - empty address", func(t *testing.T) {
    39  		_, err := aries.New(WithInboundWSAddr("", "", "", "", 0))
    40  		require.Error(t, err)
    41  		require.Contains(t, err.Error(), "ws inbound transport initialization failed")
    42  	})
    43  }
    44  
    45  func TestWithInboundWebSocketReadLimit(t *testing.T) {
    46  	a, err := aries.New(WithInboundWSAddr(":26503", "", "", "", 65536))
    47  	require.NoError(t, err)
    48  	require.NoError(t, a.Close())
    49  }