@Test
public void testInvalidNoBracketsEnformance() throws Exception {
TestMessageHook hook = new TestMessageHook();
InetSocketAddress address = new InetSocketAddress("127.0.0.1", TestUtils.getFreePort());
NettyServer server = null;
try {
Protocol protocol = createProtocol(hook);
((SMTPConfigurationImpl) protocol.getConfiguration()).setUseAddressBracketsEnforcement(false);
server = new NettyServer(protocol);
server.setListenAddresses(address);
server.bind();
SMTPClient client = createClient();
client.connect(address.getAddress().getHostAddress(), address.getPort());
assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
client.helo("localhost");
assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
client.mail(SENDER);
assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
client.addRecipient(RCPT1);
assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
client.quit();
assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
client.disconnect();
Iterator<MailEnvelope> queued = hook.getQueued().iterator();
assertFalse(queued.hasNext());
} finally {
if (server != null) {
server.unbind();
}
}
}