Fix for issues 1231 and 1234 ('start-ds logs are incomplete when we provide an invalid LDAP port' and 'Server should not start when no connection handler can be enabled').
The fix consist of the following parts:
The first part performs a check on the listener values provided if we are not in the mode where we start the server with no connection handlers; it checks whether the listener values can be used or not (and logs an error message if they cannot be used). It also checks if there are two enabled connection handlers using the same listener. Finally checks if there are any connection handlers enabled. If any of the checks above fails we send an exception and the server is not started.
The second part of the fix calls the DirectoryServer.shutDown method instead of the System.exit method. This liberates all the resources cleanly and fixes some stack printed in the output that might appear because some BufferedWriters where closed without control by the JVM when we called System.exit directly. Moreover the message that was logged during the stop of the server made reference to a shutdown caused by a system call and probably generated by an external application or the administrator himself. This message was misleading and using shutDown we clearly state the reason that caused the shutdown. DirectoryServer.bootstrapServer() and DirectoryServer.bootstrapServer() have been called before the call to DirectoryServer.shutDown() so I assume that the call is safe.
Finally the equals and hashCode methods have been overwritten in HostPort class to make them work properly in with the contains methods of the HashSets.