// encrypted send/receive testing
encrypted send/receive testing
// encrypted send / receive testing
func TestEncryptedCall(t *testing.T) {
	server1 := bilateralrpc.NewEncrypted(networkName, server1PublicKey, server1PrivateKey)
	defer server1.Close()
	server1Address := "tcp://127.0.0.1:9989"
	if err := server1.ListenOn(server1Address); nil != err {
		t.Fatalf("ConnectTo: err = %v", err)
	}
	arith := new(Arith)
	server1.Register(arith)
	client1 := bilateralrpc.NewEncrypted(networkName, client1PublicKey, client1PrivateKey)
	defer client1.Close()
	client1.Register(arith)
	if err := client1.ConnectTo(server1PublicKey, server1Address); nil != err {
		t.Fatalf("ConnectTo: err = %v", err)
	}
	waitConnect(t, client1, 1)
	args := Args{
		A: 186,
		B: 253,
	}
	var results []Result
	if err := client1.Call(nil, "Arith.SumDiffP", args, &results, 5*time.Second); nil != err {
		t.Fatalf("Call: err = %v", err)
	}
	checkResults(t, args, results, []string{server1PublicKey})
	if err := server1.Call(nil, "Arith.SumDiffP", args, &results, 5*time.Second); nil != err {
		t.Fatalf("Call: err = %v", err)
	}
	checkResults(t, args, results, []string{client1PublicKey})
}
func TestEncryptedCall ( t * testing . T ) { server1 := bilateralrpc . NewEncrypted ( networkName , server1PublicKey , server1PrivateKey ) defer server1 . Close ( ) server1Address := " " if err := server1 . ListenOn ( server1Address ) ; nil != err { t . Fatalf ( " " , err ) } arith := new ( Arith ) server1 . Register ( arith ) client1 := bilateralrpc . NewEncrypted ( networkName , client1PublicKey , client1PrivateKey ) defer client1 . Close ( ) client1 . Register ( arith ) if err := client1 . ConnectTo ( server1PublicKey , server1Address ) ; nil != err { t . Fatalf ( " " , err ) } waitConnect ( t , client1 , 1 ) args := Args { A : 186 , B : 253 , } var results [ ] Result if err := client1 . Call ( nil , " " , args , & results , 5 * time . Second ) ; nil != err { t . Fatalf ( " " , err ) } checkResults ( t , args , results , [ ] string { server1PublicKey } ) if err := server1 . Call ( nil , " " , args , & results , 5 * time . Second ) ; nil != err { t . Fatalf ( " " , err ) } checkResults ( t , args , results , [ ] string { client1PublicKey } ) }
encrypted send/receive testing
encrypted send / receive testing
// create a server // use a specific IP:Port so client can use this - (for testing with tcp) //serverAddress := "inproc://test_bilateral_calling" // listen on a port // register server objects // create a client // allow time to connect - since handshake must occur in the background // some data to send // this will receive slice of results // nil string slice will result in calls to all active connections // nil string slice will result in calls to all active connections