1 package ca.uhn.hl7v2.examples.hoh;
2
3 import java.io.IOException;
4
5 import ca.uhn.hl7v2.hoh.api.DecodeException;
6 import ca.uhn.hl7v2.hoh.api.EncodeException;
7 import ca.uhn.hl7v2.hoh.api.IReceivable;
8 import ca.uhn.hl7v2.hoh.api.ISendable;
9 import ca.uhn.hl7v2.hoh.raw.client.HohRawClientSimple;
10 import ca.uhn.hl7v2.hoh.sockets.CustomCertificateTlsSocketFactory;
11
12 public class CustomCertificateClient {
13
14
15
16
17
18
19
20 @SuppressWarnings("unused")
21 public static void main(String[] args) throws DecodeException, IOException, EncodeException {
22 ISendable<?> sendable = null;
23
24
25
26 HohRawClientSimpleentSimple.html#HohRawClientSimple">HohRawClientSimple client = new HohRawClientSimple("remotehost", 443, "/");
27
28
29 CustomCertificateTlsSocketFactoryustomCertificateTlsSocketFactory">CustomCertificateTlsSocketFactory clientSocketFactory = new CustomCertificateTlsSocketFactory();
30 clientSocketFactory.setKeystoreFilename("/path/to/truststore/truststore.jks");
31 clientSocketFactory.setKeystorePassphrase("trustpassword");
32 client.setSocketFactory(clientSocketFactory);
33
34
35 IReceivable<String> response = client.sendAndReceive(sendable);
36
37
38
39
40 }
41
42 }