本文整理匯總了Golang中github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh.FakeConn類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeConn類的具體用法?Golang FakeConn怎麽用?Golang FakeConn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeConn類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("SSH", func() {
var (
fakeTerminalHelper *terminal_helper_fakes.FakeTerminalHelper
fakeListenerFactory *fakes.FakeListenerFactory
fakeConnection *fake_ssh.FakeConn
fakeSecureClient *fakes.FakeSecureClient
fakeSecureDialer *fakes.FakeSecureDialer
fakeSecureSession *fakes.FakeSecureSession
terminalHelper terminal.TerminalHelper
keepAliveDuration time.Duration
secureShell sshCmd.SecureShell
stdinPipe *fake_io.FakeWriteCloser
currentApp models.Application
sshEndpointFingerprint string
sshEndpoint string
token string
)
BeforeEach(func() {
fakeTerminalHelper = &terminal_helper_fakes.FakeTerminalHelper{}
terminalHelper = terminal.DefaultHelper()
fakeListenerFactory = &fakes.FakeListenerFactory{}
示例2:
channelRequest := make([]byte, 5)
channel.Read(channelRequest)
Expect(string(channelRequest)).To(Equal("hello"))
channel.Write([]byte("goodbye"))
channel.Close()
})
})
})
})
})
Describe("ProxyGlobalRequests", func() {
var (
sshConn *fake_ssh.FakeConn
reqChan chan *ssh.Request
done chan struct{}
)
BeforeEach(func() {
sshConn = &fake_ssh.FakeConn{}
reqChan = make(chan *ssh.Request, 2)
done = make(chan struct{}, 1)
})
JustBeforeEach(func() {
go func(done chan<- struct{}) {
proxy.ProxyGlobalRequests(logger, sshConn, reqChan)
done <- struct{}{}
}(done)
})