@Test public void regularInstanceDefaultsToDefaultCiphers() { List<String> defaultCiphers = Arrays.asList("FOO", "BAR"); Set<String> supportedCiphers = new HashSet<String>(Arrays.asList("BAZ", "QIX")); String[] filtered = IdentityCipherSuiteFilter.INSTANCE .filterCipherSuites(null, defaultCiphers, supportedCiphers); assertArrayEquals(defaultCiphers.toArray(), filtered); }
@Override public String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers, Set<String> supportedCiphers) { if (ciphers == null) { return defaultToDefaultCiphers ? defaultCiphers.toArray(new String[defaultCiphers.size()]) : supportedCiphers.toArray(new String[supportedCiphers.size()]); } else { List<String> newCiphers = new ArrayList<String>(supportedCiphers.size()); for (String c : ciphers) { if (c == null) { break; } newCiphers.add(c); } return newCiphers.toArray(new String[newCiphers.size()]); } }
IdentityCipherSuiteFilter implements CipherSuiteFilter { @Override public String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers, Set<String> supportedCiphers) { if (ciphers == null) { return defaultToDefaultCiphers ? defaultCiphers.toArray(new String[defaultCiphers.size()]) : supportedCiphers.toArray(new String[supportedCiphers.size()]); } else { List<String> newCiphers = new ArrayList<String>(supportedCiphers.size()); for (String c : ciphers) { if (c == null) { break; } newCiphers.add(c); } return newCiphers.toArray(new String[newCiphers.size()]); } } }
IdentityCipherSuiteFilter implements CipherSuiteFilter { @Override public String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers, Set<String> supportedCiphers) { if (ciphers == null) { return defaultToDefaultCiphers ? defaultCiphers.toArray(new String[defaultCiphers.size()]) : supportedCiphers.toArray(new String[supportedCiphers.size()]); } else { List<String> newCiphers = new ArrayList<String>(supportedCiphers.size()); for (String c : ciphers) { if (c == null) { break; } newCiphers.add(c); } return newCiphers.toArray(new String[newCiphers.size()]); } } private  IdentityCipherSuiteFilter(boolean defaultToDefaultCiphers); }
IdentityCipherSuiteFilter implements CipherSuiteFilter { @Override public String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers, Set<String> supportedCiphers) { if (ciphers == null) { return defaultToDefaultCiphers ? defaultCiphers.toArray(new String[defaultCiphers.size()]) : supportedCiphers.toArray(new String[supportedCiphers.size()]); } else { List<String> newCiphers = new ArrayList<String>(supportedCiphers.size()); for (String c : ciphers) { if (c == null) { break; } newCiphers.add(c); } return newCiphers.toArray(new String[newCiphers.size()]); } } private  IdentityCipherSuiteFilter(boolean defaultToDefaultCiphers); @Override String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers,
            Set<String> supportedCiphers); }
IdentityCipherSuiteFilter implements CipherSuiteFilter { @Override public String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers, Set<String> supportedCiphers) { if (ciphers == null) { return defaultToDefaultCiphers ? defaultCiphers.toArray(new String[defaultCiphers.size()]) : supportedCiphers.toArray(new String[supportedCiphers.size()]); } else { List<String> newCiphers = new ArrayList<String>(supportedCiphers.size()); for (String c : ciphers) { if (c == null) { break; } newCiphers.add(c); } return newCiphers.toArray(new String[newCiphers.size()]); } } private  IdentityCipherSuiteFilter(boolean defaultToDefaultCiphers); @Override String[] filterCipherSuites(Iterable<String> ciphers, List<String> defaultCiphers,
            Set<String> supportedCiphers); static final IdentityCipherSuiteFilter INSTANCE; static final IdentityCipherSuiteFilter INSTANCE_DEFAULTING_TO_SUPPORTED_CIPHERS; }