MaxFragmentLengthDelegate extends Delegate { @Override public void applyDelegate(Config config) { if (maxFragmentLength != null) { config.setAddMaxFragmentLengthExtension(true); config.setMaxFragmentLength(MaxFragmentLength.getMaxFragmentLength(maxFragmentLength.byteValue())); } } MaxFragmentLengthDelegate(); Integer getMaxFragmentLength(); void setMaxFragmentLength(Integer maxFragmentLength); @Override void applyDelegate(Config config);  }
@Test public void testApplyDelegate() { Config config = Config.createConfig(); args = new String[2]; args[0] = "-max_fragment_length"; args[1] = "4"; assertFalse(config.getMaxFragmentLength() == MaxFragmentLength.TWO_12); assertFalse(config.isAddMaxFragmentLengthExtension()); jcommander.parse(args); delegate.applyDelegate(config); assertTrue(config.isAddMaxFragmentLengthExtension()); assertTrue(config.getMaxFragmentLength() == MaxFragmentLength.TWO_12); }
@Test public void testNothingSetNothingChanges() { Config config = Config.createConfig(); Config config2 = Config.createConfig(); delegate.applyDelegate(config); assertTrue(EqualsBuilder.reflectionEquals(config, config2, "keyStore", "ourCertificate")); }