Commit 105e5f6a authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/rpc: tests passing

parent 61fd3f73
package rpc
import (
"net"
"testing"
)
func testClient(t *testing.T, server *Server) *Client {
return nil
l, err := net.Listen("tcp", ":0")
if err != nil {
t.Fatalf("err: %s", err)
}
go func() {
conn, err := l.Accept()
if err != nil {
t.Fatalf("err: %s", err)
}
server.ServeConn(conn)
}()
clientConn, err := net.Dial("tcp", l.Addr().String())
if err != nil {
t.Fatalf("err: %s", err)
}
client, err := NewClient(clientConn)
if err != nil {
t.Fatalf("err: %s", err)
}
return client
}
......@@ -34,8 +34,8 @@ func (s *Server) ServeConn(conn io.ReadWriteCloser) {
mux := NewMuxConn(conn)
defer mux.Close()
// Get stream ID 0, which we always use as the stream for serving
// our RPC server on.
// Accept a connection on stream ID 0, which is always used for
// normal client to server connections.
stream, err := mux.Accept(0)
if err != nil {
log.Printf("[ERR] Error retrieving stream for serving: %s", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment