@@ -0,0 +1,1414 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.%0Apackage com.yahoo.security.tls;%0A%0Aimport javax.net.ssl.SSLEngine;%0Aimport javax.net.ssl.X509ExtendedTrustManager;%0Aimport java.net.Socket;%0Aimport java.security.cert.X509Certificate;%0A%0A/**%0A * A %7B@link X509ExtendedTrustManager%7D that accepts all server certificates.%0A *%0A * @author bjorncs%0A */%0Apublic class TrustAllX509TrustManager extends X509ExtendedTrustManager %7B%0A    @Override public void checkClientTrusted(X509Certificate%5B%5D chain, String authType, Socket socket) %7B failWhenUsedOnServer(); %7D%0A    @Override public void checkClientTrusted(X509Certificate%5B%5D chain, String authType, SSLEngine engine) %7B failWhenUsedOnServer(); %7D%0A    @Override public void checkClientTrusted(X509Certificate%5B%5D chain, String authType) %7B failWhenUsedOnServer(); %7D%0A%0A    @Override public void checkServerTrusted(X509Certificate%5B%5D chain, String authType, Socket socket) %7B%7D%0A    @Override public void checkServerTrusted(X509Certificate%5B%5D chain, String authType, SSLEngine engine) %7B%7D%0A    @Override public void checkServerTrusted(X509Certificate%5B%5D chain, String authType) %7B%7D%0A    @Override public X509Certificate%5B%5D getAcceptedIssuers() %7B return new X509Certificate%5B0%5D; %7D%0A%0A    private static void failWhenUsedOnServer() %7B%0A        throw new IllegalStateException(%22TrustAllX509TrustManager cannot be used on server, only client%22);%0A    %7D%0A%7D%0A

Add trust manager that accepts any server certificate