MCPcopy Create free account
hub / github.com/facebook/time / TestClientWriteForwarding

Function TestClientWriteForwarding

ntrip/client_test.go:232–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestClientWriteForwarding(t *testing.T) {
233 client, server := net.Pipe()
234 defer server.Close()
235
236 c := &Client{
237 config: Config{Caster: "localhost:2101", Mountpoint: "/M", Password: "p"},
238 conn: client,
239 logger: slog.Default(),
240 }
241
242 data := []byte{0xD3, 0x00, 0x04, 0x3E, 0xD0, 0x00, 0x03}
243 go func() {
244 _, err := c.Write(data)
245 require.NoError(t, err)
246 }()
247
248 buf := make([]byte, len(data))
249 _, err := io.ReadFull(server, buf)
250 require.NoError(t, err)
251 require.Equal(t, data, buf)
252}
253
254func TestClientCloseNil(t *testing.T) {
255 c := NewClient(Config{Caster: "localhost:2101", Mountpoint: "/M", Password: "p"})

Callers

nothing calls this directly

Calls 2

WriteMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…