use of ca.bc.gov.hlth.hnweb.model.v3.Address in project GreenHouse by utsanjan.
the class RealConnection method connectTls.
private void connectTls(ConnectionSpecSelector connectionSpecSelector) throws IOException {
String maybeProtocol;
Protocol protocol;
Address address = this.route.address();
SSLSocketFactory sslSocketFactory = address.sslSocketFactory();
boolean success = false;
SSLSocket sslSocket = null;
try {
try {
sslSocket = (SSLSocket) sslSocketFactory.createSocket(this.rawSocket, address.url().host(), address.url().port(), true);
ConnectionSpec connectionSpec = connectionSpecSelector.configureSecureSocket(sslSocket);
if (connectionSpec.supportsTlsExtensions()) {
Platform.get().configureTlsExtensions(sslSocket, address.url().host(), address.protocols());
}
sslSocket.startHandshake();
SSLSession sslSocketSession = sslSocket.getSession();
Handshake unverifiedHandshake = Handshake.get(sslSocketSession);
if (address.hostnameVerifier().verify(address.url().host(), sslSocketSession)) {
address.certificatePinner().check(address.url().host(), unverifiedHandshake.peerCertificates());
if (connectionSpec.supportsTlsExtensions()) {
maybeProtocol = Platform.get().getSelectedProtocol(sslSocket);
} else {
maybeProtocol = null;
}
this.socket = sslSocket;
this.source = Okio.buffer(Okio.source(sslSocket));
this.sink = Okio.buffer(Okio.sink(this.socket));
this.handshake = unverifiedHandshake;
if (maybeProtocol != null) {
protocol = Protocol.get(maybeProtocol);
} else {
protocol = Protocol.HTTP_1_1;
}
this.protocol = protocol;
success = true;
if (success) {
return;
}
return;
}
X509Certificate cert = (X509Certificate) unverifiedHandshake.peerCertificates().get(0);
throw new SSLPeerUnverifiedException("Hostname " + address.url().host() + " not verified:\n certificate: " + CertificatePinner.pin(cert) + "\n DN: " + cert.getSubjectDN().getName() + "\n subjectAltNames: " + OkHostnameVerifier.allSubjectAltNames(cert));
} catch (AssertionError e) {
if (Util.isAndroidGetsocknameError(e)) {
throw new IOException(e);
}
throw e;
}
} finally {
if (sslSocket != null) {
Platform.get().afterHandshake(sslSocket);
}
if (!success) {
Util.closeQuietly((Socket) sslSocket);
}
}
}
use of ca.bc.gov.hlth.hnweb.model.v3.Address in project eclipselink by eclipse-ee4j.
the class EmployeePopulator method addressExample6.
public Address addressExample6() {
Address address = new Address();
address.setCity("Montreal");
address.setPostalCode("Q2S5Z5");
address.setProvince("QUE");
address.setStreet("1 Habs Place");
address.setCountry("Canada");
return address;
}
use of ca.bc.gov.hlth.hnweb.model.v3.Address in project eclipselink by eclipse-ee4j.
the class EmployeePopulator method addressExample8.
public Address addressExample8() {
Address address = new Address();
address.setCity("Victoria");
address.setPostalCode("Z5J2N5");
address.setProvince("BC");
address.setStreet("382 Hyde Park");
address.setCountry("Canada");
return address;
}
use of ca.bc.gov.hlth.hnweb.model.v3.Address in project eclipselink by eclipse-ee4j.
the class EmployeePopulator method addressExample10.
public Address addressExample10() {
Address address = new Address();
address.setCity("Calgary");
address.setPostalCode("J5J2B5");
address.setProvince("ALB");
address.setStreet("1111 Moose Rd.");
address.setCountry("Canada");
return address;
}
use of ca.bc.gov.hlth.hnweb.model.v3.Address in project eclipselink by eclipse-ee4j.
the class EmployeePopulator method addressExample11.
public Address addressExample11() {
Address address = new Address();
address.setCity("Arnprior");
address.setPostalCode("W1A2B5");
address.setProvince("ONT");
address.setStreet("1 Nowhere Drive");
address.setCountry("Canada");
return address;
}
Aggregations