MCPcopy
hub / github.com/grpc/grpc-go / testLargeMsg

Function testLargeMsg

credentials/alts/internal/conn/record_test.go:168–184  ·  view source on GitHub ↗
(t *testing.T, rp string)

Source from the content-addressed store, hash-verified

166}
167
168func testLargeMsg(t *testing.T, rp string) {
169 clientConn, serverConn := newConnPair(rp, nil, nil)
170 // msgLen is such that the length in the framing is larger than the
171 // default size of one frame.
172 msgLen := altsRecordDefaultLength - msgTypeFieldSize - clientConn.crypto.EncryptionOverhead() + 1
173 msg := make([]byte, msgLen)
174 if n, err := clientConn.Write(msg); n != len(msg) || err != nil {
175 t.Fatalf("Write() = %v, %v; want %v, <nil>", n, err, len(msg))
176 }
177 rcvMsg := make([]byte, len(msg))
178 if n, err := io.ReadFull(serverConn, rcvMsg); n != len(rcvMsg) || err != nil {
179 t.Fatalf("Read() = %v, %v; want %v, <nil>", n, err, len(rcvMsg))
180 }
181 if !reflect.DeepEqual(msg, rcvMsg) {
182 t.Fatalf("Write()/Server Read() = %v, want %v", rcvMsg, msg)
183 }
184}
185
186func (s) TestLargeMsg(t *testing.T) {
187 for _, rp := range recordProtocols {

Callers 1

TestLargeMsgMethod · 0.85

Calls 4

newConnPairFunction · 0.85
EncryptionOverheadMethod · 0.65
WriteMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected