コード例 #1
0
ファイル: server.go プロジェクト: CIS-rdbrown/imap-server
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()
})