@Override
	public boolean connect(HostPort hostPort, IAgentCommand[] startupCommandAry ) throws ConnectionTimeout, ConnectionException {
		boolean ynRC = false;
		setHostPort( hostPort );
		List<String> errors = getHostPort().validate();
		
		if (errors.size()>0) { 
			ConnectionException e = new ConnectionException(getHostPort(), errors.toString() ); 
			throw e;
		} else {
	        HumanReadableMessages msgs = DefaultFactory.getFactory().getMessages();
	        long lngTimeoutMs = DefaultFactory.getFactory().getConfig().getConnectWaitMs();
			setCommandArray(startupCommandAry);
		
	        ExecutorService executor = Executors.newSingleThreadExecutor();
	        Future<Boolean> future = executor.submit(new Task());
	        try {
	            getMasterCallback().setConnectionStatusMsg(msgs.getAttemptingToConnect( getHostPort()) );
	            getMasterCallback().setConnectState(ConnectState.CONNECTING);

	            Boolean ynTaskRC = future.get(lngTimeoutMs, TimeUnit.MILLISECONDS); 
	            if (ynTaskRC.equals(Boolean.TRUE)) {
	        		NetworkDataReceiverThread2 ntt2 = getConnectionDetail().getNetworkTraceThread2();
	        		ntt2.addTraceWriter(m_traceWriter);
	        		ynRC = true;
	            }
	        } catch (TimeoutException e) {
	            getMasterCallback().setConnectionStatusMsg( e.toString() ); 
	            getMasterCallback().setConnectState(ConnectState.DISCONNECTED_ERR);
	        } catch (InterruptedException e) {
	            getMasterCallback().setConnectionStatusMsg( e.toString() ); 
	            getMasterCallback().setConnectState(ConnectState.DISCONNECTED_ERR);
			} catch (ExecutionException e) {
	            getMasterCallback().setConnectionStatusMsg( e.toString() ); 
	            getMasterCallback().setConnectState(ConnectState.DISCONNECTED_ERR);
			} finally {
		        executor.shutdownNow();
			}
		}
        return ynRC;
	}