Search in sources :

Example 1 with Address

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);
        }
    }
}
Also used : Address(okhttp3.Address) ConnectionSpec(okhttp3.ConnectionSpec) SSLSocket(javax.net.ssl.SSLSocket) SSLPeerUnverifiedException(javax.net.ssl.SSLPeerUnverifiedException) SSLSession(javax.net.ssl.SSLSession) IOException(java.io.IOException) X509Certificate(java.security.cert.X509Certificate) Protocol(okhttp3.Protocol) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) Handshake(okhttp3.Handshake)

Example 2 with Address

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;
}
Also used : Address(org.eclipse.persistence.testing.models.jpa.composite.advanced.member_1.Address)

Example 3 with 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;
}
Also used : Address(org.eclipse.persistence.testing.models.jpa.composite.advanced.member_1.Address)

Example 4 with 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;
}
Also used : Address(org.eclipse.persistence.testing.models.jpa.composite.advanced.member_1.Address)

Example 5 with 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;
}
Also used : Address(org.eclipse.persistence.testing.models.jpa.composite.advanced.member_1.Address)

Aggregations

Test (org.junit.Test)91 Address (org.orcid.jaxb.model.record_v2.Address)82 Address (org.eclipse.persistence.testing.models.jpa.composite.advanced.member_1.Address)45 Addresses (org.orcid.jaxb.model.record_v2.Addresses)43 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)43 Keyword (org.orcid.jaxb.model.record_v2.Keyword)42 OtherName (org.orcid.jaxb.model.record_v2.OtherName)42 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)42 Email (org.orcid.jaxb.model.record_v2.Email)41 EntityManager (jakarta.persistence.EntityManager)36 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 Biography (org.orcid.jaxb.model.record_v2.Biography)34 Emails (org.orcid.jaxb.model.record_v2.Emails)34 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)33 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 JpaEntityManager (org.eclipse.persistence.jpa.JpaEntityManager)31 Name (org.orcid.jaxb.model.record_v2.Name)31 Person (org.orcid.jaxb.model.record_v2.Person)31 Employee (org.eclipse.persistence.testing.models.jpa.composite.advanced.member_2.Employee)26