* Extract gRPC proxy func to separate package
* Use debug logs for err on `stream.Recv()`
* Add regression test for treating server response as authoritative
The current buggy code path: `forwardServerToClient` returns nil on
server trailer, main waits on `<-errCh`, `forwardClientToServer` is
parked in `client.Recv()` until either the connection is torn down
(hang) or the client happens to send another message whose `server.Send`
fails on the half-closed upstream (reshape: server's nil becomes a
proxy-side error).
* Treat server response as authoritative & propagate client-side errors
* Migrate tests to use a custom gRPC service
* Test if errs from client.Recv and server.Send are surfaced
* Fix flaky `TestProxyBidiStream_ReturnsEOFWhenServerReturnsEarly`
* Don't set `clientErrCh` to `nil`
* Use existing gRPC service instead of special one for tests
* Forward header and trailer to client; use bufconn in tests
Co-authored-by: Tiago Silva <[email protected]>
---------
Co-authored-by: Tiago Silva <[email protected]>