Home > database >  configure SSL in HapiContext (Hapi-base 2.3)
configure SSL in HapiContext (Hapi-base 2.3)

Time:10-08

In one of our spring boot apps used in Springcloud dataflow streams, we are currently using HapiContext to construct a new HL7 client and establish a connection out of it to send HL7 messages to a TCP host and port.

@Autowired
HapiContext context;

Connection connection = context.newClient(host, Integer.parseInt(port), false);
 
// The initiator which will be used to transmit our message
    Initiator initiator = connection.getInitiator();

    Message response = initiator.sendAndReceive(adtMessage);

Currently we are not using SSL/TLS for this connection and call. but we now have a requirement such that the call should be changed to an SSL based one.

I have tried doing a lot of searches on the Internet, but I am not able to find any documentation on how to achieve this.

Is there anyway to get this done?

CodePudding user response:

How are you creating the HapiContext?

The DefaultHapiContext seems to provide for creating a client with a tls parameter.

CodePudding user response:

lookup for the ca.uhn.hl7v2.hoh.sockets.CustomCertificateTlsSocketFactory, this should have createClientSocket which will add the SSL context necessary

  • Related