示例#1
0
				sshChannel, requestChan, openError = client.OpenChannel(channelType, []byte("extra-data"))
			})

			Context("and there is an associated handler", func() {
				BeforeEach(func() {
					channelType = "known-channel-type"

					fakeHandler.HandleNewChannelStub = func(logger lager.Logger, newChannel ssh.NewChannel) {
						ch, _, err := newChannel.Accept()
						Expect(err).NotTo(HaveOccurred())
						ch.Close()
					}
				})

				It("calls the handler to process the new channel request", func() {
					Expect(fakeHandler.HandleNewChannelCallCount()).To(Equal(1))

					logger, actualChannel := fakeHandler.HandleNewChannelArgsForCall(0)
					Expect(logger).NotTo(BeNil())

					Expect(actualChannel.ChannelType()).To(Equal("known-channel-type"))
					Expect(actualChannel.ExtraData()).To(Equal([]byte("extra-data")))
				})
			})

			Context("and there is not an associated handler", func() {
				BeforeEach(func() {
					channelType = "unknown-channel-type"
				})

				It("rejects the new channel request", func() {