JavaSPI: A Framework for Security Protocol Implementation