use of test.newrelic.test.agent.api.MessagingTestServer in project newrelic-java-agent by newrelic.
the class SpanParentTest method txnStarter.
@Trace(dispatcher = true)
private Header txnStarter(boolean noticeError) {
Transaction txn = ServiceFactory.getServiceManager().getTransactionService().getTransaction(false);
DistributedTracePayloadImpl payload = DistributedTracePayloadImpl.createDistributedTracePayload(null, txn.getGuid(), txn.getGuid(), 1.0f);
txn.acceptDistributedTracePayload(payload.httpSafe());
MessagingTestServer server = new MessagingTestServer(8093);
Header header = null;
if (noticeError) {
NewRelic.noticeError(new RuntimeException("I am something"));
}
try {
server.start();
header = runTestMessagingAPI();
} catch (IOException e) {
e.printStackTrace();
} finally {
server.stop();
}
return header;
}
Aggregations