Example #1
0
func TestRoundTripUnpooled(t *testing.T) {
	l := startServer(t, true, nil)
	d := dialerFor(t, l, 0)
	defer d.Close()

	proxy.Test(t, d)
}
Example #2
0
func TestSuccess(t *testing.T) {
	l := startServer(t)

	dialer := NewDialer(Config{
		DialServer: func() (net.Conn, error) {
			return net.Dial(l.Addr().Network(), l.Addr().String())
		},
	})

	proxy.Test(t, dialer)
}
Example #3
0
func TestRoundTripUnpooled(t *testing.T) {
	l := startServer(t, true, nil)
	d := dialerFor(t, l, 0)
	defer func() {
		if err := d.Close(); err != nil {
			t.Fatalf("Unable to close dialer: %v", err)
		}
	}()

	proxy.Test(t, d)
}
Example #4
0
func TestSuccess(t *testing.T) {
	l := startServer(t)

	dialer := NewDialer(Config{
		DialServer: func() (net.Conn, error) {
			log.Debugf("Dialing with timeout to: %v", l.Addr())
			conn, err := net.DialTimeout(l.Addr().Network(), l.Addr().String(), 2*time.Second)
			log.Debugf("Got conn %v and err %v", conn, err)
			return conn, err
		},
	})

	log.Debugf("TESTING SUCCESS")
	proxy.Test(t, dialer)
}