private static List<X509Certificate> getPeerX509Certificates(SSLSession session) {
        try {
            final Certificate[] certs = session.getPeerCertificates();
            if (certs == null) {
                return ImmutableList.of();
            }

            final ImmutableList.Builder<X509Certificate> builder =
                    ImmutableList.builderWithExpectedSize(certs.length);
            for (Certificate c : certs) {
                if (c instanceof X509Certificate) {
                    builder.add((X509Certificate) c);
                }
            }

            return builder.build();
        } catch (SSLPeerUnverifiedException ignored) {
            return ImmutableList.of();
        }
    }
Fills the Servlet TLS attributes from {@link SSLSession} into {@code ServletRequest}.

@param session the {@link SSLSession} of the current connection.
@param setter the setter that will be invoked with the Servlet attribute name and value.
core/src/main/java/com/linecorp/armeria/internal/server/servlet/ServletTlsAttributes.java