本文整理匯總了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))
})
})
})