/** * Writes an LDAPMessage to the LDAP server over a socket. * * @param info the Message containing the message to write. */ /* package */ void writeMessage(Message info) throws LDAPException { messages.addElement( info); // For bind requests, if not connected, attempt to reconnect if( info.isBindRequest() && (isConnected() == false) && (host != null)){ connect( host, port, info.getMessageID()); } if(isConnected()) { LDAPMessage msg = info.getRequest(); writeMessage( msg); return; } else throw new LDAPException(ExceptionMessages.CONNECTION_CLOSED, new Object[] { host, new Integer(port) }, LDAPException.CONNECT_ERROR, null,new IOException()); }