SessionResumptionDelegate extends Delegate { @Override public void applyDelegate(Config config) { if (sessionId != null) { config.setDefaultClientSessionId(sessionId); config.setDefaultServerSessionId(sessionId); } } SessionResumptionDelegate(); byte[] getSessionId(); void setSessionId(byte[] sessionId); @Override void applyDelegate(Config config);  }
@Test public void testApplyDelegate() { Config config = Config.createConfig(); args = new String[2]; args[0] = "-session_id"; args[1] = "00112233445566778899AABBCCDDEEFF"; delegate.setSessionId(null); jcommander.parse(args); delegate.applyDelegate(config); byte[] expected = { (byte) 0x00, (byte) 0x11, (byte) 0x22, (byte) 0x33, (byte) 0x44, (byte) 0x55, (byte) 0x66, (byte) 0x77, (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF }; assertArrayEquals(config.getDefaultClientSessionId(), expected); assertArrayEquals(config.getDefaultServerSessionId(), expected); }
@Test public void testNothingSetNothingChanges() { Config config = Config.createConfig(); Config config2 = Config.createConfig(); delegate.applyDelegate(config); assertTrue(EqualsBuilder.reflectionEquals(config, config2, "keyStore", "ourCertificate")); }