TProtocol outputProtocol = clientManager.getOutputProtocol(client);
TTransport outputTransport = outputProtocol.getTransport();
if (outputTransport instanceof THeaderTransport) {
LOG.info("adding headers to next client request");
THeaderTransport headerTransport = (THeaderTransport) outputTransport;
headerTransport.setHeader("header_from", "client");
}
else {
LOG.info("output transport for client was not THeaderTransport, client cannot send headers");
}
client.headerUsageExampleMethod();
TProtocol inputProtocol = clientManager.getInputProtocol(client);
TTransport inputTransport = inputProtocol.getTransport();
if (inputTransport instanceof THeaderTransport) {
LOG.info("headers received from the server in the response:");
THeaderTransport headerTransport = (THeaderTransport) outputTransport;
for (String key : headerTransport.getReadHeaders().keySet()) {
LOG.info("header '" + key + "' => '" + headerTransport.getReadHeaders().get(key) + "'");
}
}
else {
LOG.info("output transport for client was not THeaderTransport, client cannot send headers");
}