TLS1_2SocketFactory extends SSLSocketFactory { @Override public SSLSocket createSocket() throws IOException { return forceTLS1_2(delegate.createSocket()); } TLS1_2SocketFactory(); @Override String[] getDefaultCipherSuites(); @Override String[] getSupportedCipherSuites(); @Override SSLSocket createSocket(); @Override SSLSocket createSocket(String host, int port); @Override SSLSocket createSocket(InetAddress host, int port); @Override SSLSocket createSocket(String host, int port, InetAddress localHost, int localPort); @Override SSLSocket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort); @Override SSLSocket createSocket(Socket socket, String host, int port, boolean autoClose);  }
@Test public void createSocket() throws Exception { checkProtocol(getFactory().createSocket()); checkProtocol(getFactory().createSocket("localhost", 80)); checkProtocol(getFactory().createSocket(mock(InetAddress.class), 80)); checkProtocol(getFactory().createSocket("localhost", 80, mock(InetAddress.class), 8080)); checkProtocol(getFactory().createSocket(mock(InetAddress.class), 80, mock(InetAddress.class), 8080)); checkProtocol(getFactory().createSocket(mock(Socket.class), "localhost", 80, true)); assertArrayEquals(DEFAULT_CIPHER_SUITES, getFactory().getDefaultCipherSuites()); assertArrayEquals(SUPPORTED_CIPHER_SUITES, getFactory().getSupportedCipherSuites()); }