mirror of
https://github.com/linka-cloud/grpc.git
synced 2025-10-19 03:41:46 +00:00
add grpc-proxy (github.com/mwitkow/grpc-proxy)
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
23
proxy/codec_test.go
Normal file
23
proxy/codec_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCodec_ReadYourWrites(t *testing.T) {
|
||||
framePtr := &frame{}
|
||||
data := []byte{0xDE, 0xAD, 0xBE, 0xEF}
|
||||
codec := rawCodec{}
|
||||
require.NoError(t, codec.Unmarshal(data, framePtr), "unmarshalling must go ok")
|
||||
out, err := codec.Marshal(framePtr)
|
||||
require.NoError(t, err, "no marshal error")
|
||||
require.Equal(t, data, out, "output and data must be the same")
|
||||
|
||||
// reuse
|
||||
require.NoError(t, codec.Unmarshal([]byte{0x55}, framePtr), "unmarshalling must go ok")
|
||||
out, err = codec.Marshal(framePtr)
|
||||
require.NoError(t, err, "no marshal error")
|
||||
require.Equal(t, []byte{0x55}, out, "output and data must be the same")
|
||||
}
|
Reference in New Issue
Block a user