private String createCertificateStore ( String resourceName ) throws IOException { URL resource = StubServer . class . getResource ( "/" + resourceName ) ; File store = File . createTempFile ( resourceName , "store" ) ; try ( InputStream input = resource . openStream ( ) ) { Files . copy ( input , store . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; } finally { store . deleteOnExit ( ) ; } return store . getAbsolutePath ( ) ; }
Copy the Certificate store to the temporary directory as it needs to be in a real file not inside a jar for Grizzly to pick it up .