@Override
    public String get(String key) throws KVException {
        if (key == null || key.length() == 0)
        	throw new KVException(KVConstants.ERROR_INVALID_KEY);
        
        KVMessage kvm = new KVMessage(KVConstants.GET_REQ);
        kvm.setKey(key);
        
        Socket sock = null;
        String value = null;
        
        try {
        	sock = connectHost();
        	kvm.sendMessage(sock);
        	
        	KVMessage receive = new KVMessage(sock);
        	
        	if (receive.getKey() == null || receive.getValue() == null)
        		throw new KVException(receive.getMessage());
        	value = receive.getValue();
        }
        catch (KVException ex) {
        	throw ex;
        }
        finally {
        	if (sock != null)
        		closeHost(sock);
        }
        return value;
    }