本文整理汇总了Golang中github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_net.FakeConn.CloseStub方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeConn.CloseStub方法的具体用法?Golang FakeConn.CloseStub怎么用?Golang FakeConn.CloseStub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_net.FakeConn
的用法示例。
在下文中一共展示了FakeConn.CloseStub方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Context("when HandleConnection returns", func() {
var fakeServerConnection *fake_net.FakeConn
BeforeEach(func() {
proxySSHConfig.NoClientAuth = true
daemonSSHConfig.NoClientAuth = true
})
JustBeforeEach(func() {
clientNetConn, serverNetConn := test_helpers.Pipe()
fakeServerConnection = &fake_net.FakeConn{}
fakeServerConnection.ReadStub = serverNetConn.Read
fakeServerConnection.WriteStub = serverNetConn.Write
fakeServerConnection.CloseStub = serverNetConn.Close
go sshProxy.HandleConnection(fakeServerConnection)
clientConn, clientChannels, clientRequests, err := ssh.NewClientConn(clientNetConn, "0.0.0.0", clientConfig)
Expect(err).NotTo(HaveOccurred())
client := ssh.NewClient(clientConn, clientChannels, clientRequests)
client.Close()
})
It("ensures the network connection is closed", func() {
Eventually(fakeServerConnection.CloseCallCount).Should(BeNumerically(">=", 1))
})
})
})