// Code generated by counterfeiter. DO NOT EDIT.
package connectionfakes

import (
	"bufio"
	"io"
	"net"
	"net/url"
	"sync"

	"code.cloudfoundry.org/garden/client/connection"
	"github.com/tedsuo/rata"
)

type FakeHijackStreamer struct {
	StreamStub        func(handler string, body io.Reader, params rata.Params, query url.Values, contentType string) (io.ReadCloser, error)
	streamMutex       sync.RWMutex
	streamArgsForCall []struct {
		handler     string
		body        io.Reader
		params      rata.Params
		query       url.Values
		contentType string
	}
	streamReturns struct {
		result1 io.ReadCloser
		result2 error
	}
	streamReturnsOnCall map[int]struct {
		result1 io.ReadCloser
		result2 error
	}
	HijackStub        func(handler string, body io.Reader, params rata.Params, query url.Values, contentType string) (net.Conn, *bufio.Reader, error)
	hijackMutex       sync.RWMutex
	hijackArgsForCall []struct {
		handler     string
		body        io.Reader
		params      rata.Params
		query       url.Values
		contentType string
	}
	hijackReturns struct {
		result1 net.Conn
		result2 *bufio.Reader
		result3 error
	}
	hijackReturnsOnCall map[int]struct {
		result1 net.Conn
		result2 *bufio.Reader
		result3 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeHijackStreamer) Stream(handler string, body io.Reader, params rata.Params, query url.Values, contentType string) (io.ReadCloser, error) {
	fake.streamMutex.Lock()
	ret, specificReturn := fake.streamReturnsOnCall[len(fake.streamArgsForCall)]
	fake.streamArgsForCall = append(fake.streamArgsForCall, struct {
		handler     string
		body        io.Reader
		params      rata.Params
		query       url.Values
		contentType string
	}{handler, body, params, query, contentType})
	fake.recordInvocation("Stream", []interface{}{handler, body, params, query, contentType})
	fake.streamMutex.Unlock()
	if fake.StreamStub != nil {
		return fake.StreamStub(handler, body, params, query, contentType)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fake.streamReturns.result1, fake.streamReturns.result2
}

func (fake *FakeHijackStreamer) StreamCallCount() int {
	fake.streamMutex.RLock()
	defer fake.streamMutex.RUnlock()
	return len(fake.streamArgsForCall)
}

func (fake *FakeHijackStreamer) StreamArgsForCall(i int) (string, io.Reader, rata.Params, url.Values, string) {
	fake.streamMutex.RLock()
	defer fake.streamMutex.RUnlock()
	return fake.streamArgsForCall[i].handler, fake.streamArgsForCall[i].body, fake.streamArgsForCall[i].params, fake.streamArgsForCall[i].query, fake.streamArgsForCall[i].contentType
}

func (fake *FakeHijackStreamer) StreamReturns(result1 io.ReadCloser, result2 error) {
	fake.StreamStub = nil
	fake.streamReturns = struct {
		result1 io.ReadCloser
		result2 error
	}{result1, result2}
}

func (fake *FakeHijackStreamer) StreamReturnsOnCall(i int, result1 io.ReadCloser, result2 error) {
	fake.StreamStub = nil
	if fake.streamReturnsOnCall == nil {
		fake.streamReturnsOnCall = make(map[int]struct {
			result1 io.ReadCloser
			result2 error
		})
	}
	fake.streamReturnsOnCall[i] = struct {
		result1 io.ReadCloser
		result2 error
	}{result1, result2}
}

func (fake *FakeHijackStreamer) Hijack(handler string, body io.Reader, params rata.Params, query url.Values, contentType string) (net.Conn, *bufio.Reader, error) {
	fake.hijackMutex.Lock()
	ret, specificReturn := fake.hijackReturnsOnCall[len(fake.hijackArgsForCall)]
	fake.hijackArgsForCall = append(fake.hijackArgsForCall, struct {
		handler     string
		body        io.Reader
		params      rata.Params
		query       url.Values
		contentType string
	}{handler, body, params, query, contentType})
	fake.recordInvocation("Hijack", []interface{}{handler, body, params, query, contentType})
	fake.hijackMutex.Unlock()
	if fake.HijackStub != nil {
		return fake.HijackStub(handler, body, params, query, contentType)
	}
	if specificReturn {
		return ret.result1, ret.result2, ret.result3
	}
	return fake.hijackReturns.result1, fake.hijackReturns.result2, fake.hijackReturns.result3
}

func (fake *FakeHijackStreamer) HijackCallCount() int {
	fake.hijackMutex.RLock()
	defer fake.hijackMutex.RUnlock()
	return len(fake.hijackArgsForCall)
}

func (fake *FakeHijackStreamer) HijackArgsForCall(i int) (string, io.Reader, rata.Params, url.Values, string) {
	fake.hijackMutex.RLock()
	defer fake.hijackMutex.RUnlock()
	return fake.hijackArgsForCall[i].handler, fake.hijackArgsForCall[i].body, fake.hijackArgsForCall[i].params, fake.hijackArgsForCall[i].query, fake.hijackArgsForCall[i].contentType
}

func (fake *FakeHijackStreamer) HijackReturns(result1 net.Conn, result2 *bufio.Reader, result3 error) {
	fake.HijackStub = nil
	fake.hijackReturns = struct {
		result1 net.Conn
		result2 *bufio.Reader
		result3 error
	}{result1, result2, result3}
}

func (fake *FakeHijackStreamer) HijackReturnsOnCall(i int, result1 net.Conn, result2 *bufio.Reader, result3 error) {
	fake.HijackStub = nil
	if fake.hijackReturnsOnCall == nil {
		fake.hijackReturnsOnCall = make(map[int]struct {
			result1 net.Conn
			result2 *bufio.Reader
			result3 error
		})
	}
	fake.hijackReturnsOnCall[i] = struct {
		result1 net.Conn
		result2 *bufio.Reader
		result3 error
	}{result1, result2, result3}
}

func (fake *FakeHijackStreamer) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.streamMutex.RLock()
	defer fake.streamMutex.RUnlock()
	fake.hijackMutex.RLock()
	defer fake.hijackMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *FakeHijackStreamer) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ connection.HijackStreamer = new(FakeHijackStreamer)
