ResetConnectionAction extends ConnectionBoundAction { @Override public void execute(State state) throws WorkflowExecutionException { TlsContext tlsContext = state.getTlsContext(getConnectionAlias()); LOGGER.info("Terminating Connection"); try { tlsContext.getTransportHandler().closeClientConnection(); } catch (IOException ex) { LOGGER.debug("Could not close client connection", ex); } LOGGER.info("Resseting Cipher"); tlsContext.getRecordLayer().setRecordCipher(new RecordNullCipher(tlsContext)); tlsContext.getRecordLayer().updateDecryptionCipher(); tlsContext.getRecordLayer().updateEncryptionCipher(); LOGGER.info("Resetting SecureRenegotaiton"); tlsContext.setLastClientVerifyData(new byte[0]); tlsContext.setLastServerVerifyData(new byte[0]); LOGGER.info("Resetting MessageDigest"); tlsContext.getDigest().reset(); LOGGER.info("Resetting ActiveKeySets"); tlsContext.setActiveClientKeySetType(Tls13KeySetType.NONE); tlsContext.setActiveServerKeySetType(Tls13KeySetType.NONE); tlsContext.setReadSequenceNumber(0); tlsContext.setWriteSequenceNumber(0); LOGGER.info("Resetting DTLS numbers and cookie"); tlsContext.setDtlsCookie(new byte[] {}); tlsContext.setDtlsReadHandshakeMessageSequence(0); tlsContext.setDtlsWriteHandshakeMessageSequence(0); tlsContext.setDtlsReceiveEpoch(0); tlsContext.setDtlsWriteEpoch(0); LOGGER.info("Reopening Connection"); try { tlsContext.getTransportHandler().initialize(); asPlanned = true; } catch (IOException ex) { LOGGER.debug("Could not initialize TransportHandler", ex); asPlanned = false; } setExecuted(true); } ResetConnectionAction();  ResetConnectionAction(String connectionAlias); @Override void execute(State state); @Override void reset(); @Override boolean executedAsPlanned();  }
@Test public void testExecute() throws IOException { action.execute(state); TlsRecordLayer layer = TlsRecordLayer.class.cast(tlsContext.getRecordLayer()); assertTrue(layer.getRecordCipher() instanceof RecordNullCipher); assertTrue(layer.getEncryptorCipher() instanceof RecordNullCipher); assertTrue(layer.getDecryptorCipher() instanceof RecordNullCipher); assertEquals(tlsContext.getActiveClientKeySetType(), Tls13KeySetType.NONE); assertEquals(tlsContext.getActiveServerKeySetType(), Tls13KeySetType.NONE); assertFalse(tlsContext.getTransportHandler().isClosed()); assertTrue(action.isExecuted()); }