}
private HttpPlatformLayerClient buildPlatformLayerClient(Properties properties, boolean debug) {
HttpStrategy httpStrategy = new JreHttpStrategy();
// HttpStrategy httpStrategy = new ApacheCommonsHttpStrategy();
HttpPlatformLayerClient client = HttpPlatformLayerClient.buildUsingProperties(httpStrategy, properties);
if (debug) {
client.setDebug(System.err);
} else {
// We don't want debug messages to interfere with our output
// TODO: Fix this so debug output doesn't interfere (stderr?)
// TODO: Maybe output the debug info only in case of failure?
ByteArrayOutputStream baos = new ByteArrayOutputStream();
client.setDebug(new PrintStream(baos));
}
return client;
}