--- src/test/org/apache/james/smtpserver/SMTPServerTest.java	2006-03-30 14:08:43.000000000 +0200
+++ src/test/org/apache/james/smtpserver/SMTPServerTestNew.java	2006-03-30 15:05:58.000000000 +0200
@@ -60,14 +60,14 @@
 /**
  * Tests the org.apache.james.smtpserver.SMTPServer unit 
  */
-public class SMTPServerTest extends TestCase {
+public class SMTPServerTestNew extends TestCase {
     private int m_smtpListenerPort = Util.getRandomNonPrivilegedPort();
     private MockMailServer m_mailServer;
     private SMTPTestConfiguration m_testConfiguration;
     private SMTPServer m_smtpServer;
     private MockUsersRepository m_usersRepository = new MockUsersRepository();
 
-    public SMTPServerTest() {
+    public SMTPServerTestNew() {
         super("SMTPServerTest");
     }
 
@@ -266,6 +266,7 @@
 
         smtpProtocol1.quit();
     }
+    
     public void testHeloResolv() throws Exception, SMTPException {
         m_testConfiguration.setHeloResolv();
         finishSetUp(m_testConfiguration);
@@ -309,6 +310,49 @@
         smtpProtocol1.quit();
     }
     
+    public void testEhloResolv() throws Exception, SMTPException {
+        m_testConfiguration.setEhloResolv();
+        finishSetUp(m_testConfiguration);
+
+
+        MySMTPProtocol smtpProtocol1 = new MySMTPProtocol("127.0.0.1", m_smtpListenerPort);
+        smtpProtocol1.openPort();
+
+        assertEquals("first connection taken", 1, smtpProtocol1.getState());
+
+        // no message there, yet
+        assertNull("no mail received by mail server", m_mailServer.getLastMail());
+
+        String[] ehlo1 = new String[] { "abgsfe3rsf.de"};
+        String[] ehlo2 = new String[] { "james.apache.org" };
+        
+        smtpProtocol1.sendCommand("ehlo",ehlo1);
+        SMTPResponse response = smtpProtocol1.getResponse();
+        // this should give a 501 code cause the ehlo could not resolved
+        assertEquals("expected error: ehlo could not resolved", 501, response.getCode());
+            
+        smtpProtocol1.sendCommand("ehlo", ehlo2);
+        SMTPResponse response2 = smtpProtocol1.getResponse();
+        // ehlo is resolvable. so this should give a 250 code
+        assertEquals("ehlo accepted", 250, response2.getCode());
+
+        smtpProtocol1.quit();
+    }
+    
+    public void testEhloResolvDefault() throws Exception, SMTPException {
+        finishSetUp(m_testConfiguration);
+
+        MySMTPProtocol smtpProtocol1 = new MySMTPProtocol("127.0.0.1", m_smtpListenerPort);
+        smtpProtocol1.openPort();
+        
+        smtpProtocol1.sendCommand("ehlo",new String[]{"abgsfe3rsf.de"});
+        SMTPResponse response = smtpProtocol1.getResponse();
+        // ehlo should not be checked. so this should give a 250 code
+        assertEquals("ehlo accepted", 250, response.getCode());
+
+        smtpProtocol1.quit();
+    }
+    
     public void testHeloEnforcement() throws Exception, SMTPException {
         finishSetUp(m_testConfiguration);
 
--- src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java	2006-03-30 14:08:43.000000000 +0200
+++ src/test/org/apache/james/smtpserver/SMTPTestConfigurationNew.java	2006-03-30 15:00:13.000000000 +0200
@@ -21,7 +21,7 @@
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.james.test.util.Util;
 
-public class SMTPTestConfiguration extends DefaultConfiguration {
+public class SMTPTestConfigurationNew extends DefaultConfiguration {
 
     private int m_smtpListenerPort;
     private int m_maxMessageSize = 0;
@@ -30,8 +30,9 @@
     private boolean m_verifyIdentity = false;
     private Integer m_connectionLimit = null;
     private boolean m_heloResolv = false;
-
-    public SMTPTestConfiguration(int smtpListenerPort) {
+    private boolean m_ehloResolv = false;
+    
+    public SMTPTestConfigurationNew(int smtpListenerPort) {
         super("smptserver");
 
         m_smtpListenerPort = smtpListenerPort;
@@ -76,6 +77,10 @@
     public void setHeloResolv() {
         m_heloResolv = true; 
     }
+    
+    public void setEhloResolv() {
+        m_ehloResolv = true; 
+    }
 
     public void init() {
 
@@ -94,10 +99,10 @@
         
         handlerConfig.addChild(Util.createRemoteManagerHandlerChainConfiguration());
         
-        // Add Configuration for Helo checks
-
+        // Add Configuration for Helo checks and Ehlo checks
         DefaultConfiguration heloConfig = (DefaultConfiguration) handlerConfig.getChild("handlerchain").getChild("handler");
         heloConfig.addChild(Util.getValuedConfiguration("checkValidHelo",m_heloResolv+""));     
+        heloConfig.addChild(Util.getValuedConfiguration("checkValidEhlo",m_ehloResolv+""));  
         
         addChild(handlerConfig);
     }
