Login Usando Apache HttpComponents

Olá galera,

A algum tempo atrás perguntei a respeito de login e navegação usando o Apache HttpComponents:

http://www.guj.com.br/java/305261-login-e-navegacao-usando-apache-httpcomponents#1624070

Consegui resolver por conta todos os problemas descritos no post, porém agora estou com um problema MUITO maior.
Eis o código:

public static void main(String[] args) throws IllegalStateException, IOException {
		SSLContext ctx = null;
		try {
			ctx = SSLContext.getInstance("TLS");
			ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()}, new SecureRandom());

		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (KeyManagementException e) {
			e.printStackTrace();
		}
		
		SSLSocketFactory sf = new SSLSocketFactory(ctx);
		Scheme httpsScheme = new Scheme("https", 443, sf);
		SchemeRegistry schemeRegistry = new SchemeRegistry();
		schemeRegistry.register(httpsScheme);
		ClientConnectionManager cm = new SingleClientConnManager(schemeRegistry);
		
		DefaultHttpClient client = new DefaultHttpClient(cm);
		client.setCookieStore(cookieStore);

		/* Método POST */
		HttpPost post = new HttpPost("https://localhost/loginServlet");

		/* Configura os parâmetros do POST */
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
		nameValuePairs.add(new BasicNameValuePair("Username", "usertest"));
		nameValuePairs.add(new BasicNameValuePair("Password", "passtest"));
		nameValuePairs.add(new BasicNameValuePair("cmdConfirmar", "Confirmar"));
		
		//Codifica os parametros.
		post.setEntity(new UrlEncodedFormEntity(nameValuePairs, Consts.UTF_8));
		
		/* Efetua o POST */
		HttpResponse response = null;

		try {
			response = client.execute(post);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		try {
			HttpEntity entity = response.getEntity();

			String body = IOUtils.toString(entity.getContent(), "UTF-8");
			System.out.println(body);
			
			EntityUtils.consume(entity);
		} catch (IOException e) {
			System.out.println("Erro 5 - IO");
		}

		client.close();
}

Eu já “consigo” fazer login no site que eu quero. Na verdade eu consigo fazer a submissão para login (passando pelos certificados de segurança e tudo mais), mas o servlet responsável por responder a requisição envia para uma página que pede para habilitar os cookies antes de efetuar o login, ou seja, o servidor não considera que o programa utilize os cookies fornecidos.

Alguem pode me ajudar em alguma forma de contornar isso?

Desde já, Grato!

Ps.: Dando uma olhada nos headers retornados pelo método POST, eu percebi que a API salva os cookies em um header definido como “Set-Cookie” (imagino então que os cookies estão habilitados).