@Test
	void testTwoMailsInOneSession() throws Exception {
		when(messageHandlerFactory.create(any(MessageContext.class))).thenReturn(messageHandler, messageHandler2);

		final SmartClient client = new SmartClient("localhost", smtpServer.getPort(), "localhost");

		client.from("john1@example.com");
		client.to("jane1@example.com");
		client.dataStart();
		client.dataWrite("body1".getBytes(StandardCharsets.US_ASCII), 5);
		client.dataEnd();

		client.from("john2@example.com");
		client.to("jane2@example.com");
		client.dataStart();
		client.dataWrite("body2".getBytes(StandardCharsets.US_ASCII), 5);
		client.dataEnd();

		client.quit();

		smtpServer.stop(); // wait for the server to catch up

		verify(messageHandlerFactory, times(2)).create(any(MessageContext.class));
		verify(messageHandler).from(anyString());
		verify(messageHandler).recipient(anyString());
		verify(messageHandler).data(any(InputStream.class));
		verify(messageHandler).done();
		verify(messageHandler2).from(anyString());
		verify(messageHandler2).recipient(anyString());
		verify(messageHandler2).data(any(InputStream.class));
		verify(messageHandler2).done();
		verifyNoMoreInteractions(messageHandlerFactory, messageHandler, messageHandler2);
	}
This class tests whether the event handler methods defined in MessageHandler
are called at the appropriate times and in good order.
src/test/java/de/gessnerfl/fakesmtp/smtp/server/MessageHandlerTest.java