use of ca.uhn.hl7v2.app.ConnectionListener in project streamsx.health by IBMStreams.
the class TestServer method main.
public static void main(String[] args) {
try {
HapiContext ctx = new DefaultHapiContext();
CanonicalModelClassFactory mcf = new CanonicalModelClassFactory("2.6");
ctx.setModelClassFactory(mcf);
ctx.setValidationRuleBuilder(new NoValidationBuilder());
ctx.setExecutorService(Executors.newCachedThreadPool());
HL7Service server = ctx.newServer(8082, false);
server.registerApplication(new HapiMessageHandler(null));
server.registerConnectionListener(new ConnectionListener() {
@Override
public void connectionReceived(Connection c) {
System.out.println("Connection received.");
}
@Override
public void connectionDiscarded(Connection c) {
System.out.println("Connection discarded.");
}
});
server.startAndWait();
ctx.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations