Пример #1
0
func (s *Server) newConn(netConn net.Conn) (c *conn.Conn, err error) {
	c = conn.NewConn(s.mailstore, netConn, s.Transcript)
	c.SetState(conn.StateNew)
	return c, nil
}
Пример #2
0
	expected = strings.TrimSpace(expected)
	response = strings.TrimSpace(response)
	Expect(response, err).To(Equal(expected))
}

func ExpectResponsePattern(pattern string) {
	response, err := reader.ReadLine()
	pattern = strings.TrimSpace(pattern)
	response = strings.TrimSpace(response)
	Expect(response, err).To(MatchRegexp(pattern))
}

// === SETUP ====
var _ = BeforeEach(func() {
	mStore = mailstore.NewDummyMailstore()
	mockConn = mock_conn.NewConn()
	tConn = conn.NewConn(mStore, mockConn.Server, GinkgoWriter)
	reader = textproto.NewReader(bufio.NewReader(mockConn.Client))
})

var _ = JustBeforeEach(func() {
	go tConn.Start()
})

// === TEARDOWN ====

var _ = AfterEach(func() {
	tConn.Close()
	mockConn.Close()
})