Buggy code:
public class WebServerTest { @ Before public void before ( ) { } @ Test public void testWebServer ( ) throws Exception { WebServer . setPoolSize ( 10 , 40 ) ; WebServer . init ( "localhost" , 8181 ) ; <START_BUG> WebServer . https ( 8282 , "src//test//resources//key.jks" , "storepwd" , "keypwd" ) ; <END_BUG> WebServer . setLoginService ( ( userName ) -> { if ( userName . equals ( "admin1" ) ) { return new WebUser ( "admin1" , "CRYPT:adpexzg3FUZAk" , new String [ ] { "user" } ) ; } return null ; } ) ; WebServer . security ( "//login" , "//login" , "//logout" ) ; WebServer . addStaticContentHandler ( "//static" , "tmp" ) ; File . writeString ( "123" , "tmp//webserver.txt" ) ; WebServer . addHandler ( "//script" , ( request , response ) -> "Bla-Bla" ) ; WebServer . addHandler ( "//new" , ( request , response ) -> "new<seq2seq4repair_space>new" ) ; WebServer . addAllowRule ( "//*" ) ; WebServer . addRestrictRule ( "//new" , new String [ ] { "user" } ) ; WebServer . addHandler ( "//login" , ( request , response ) -> "<form<seq2seq4repair_space>method='POST'<seq2seq4repair_space>action='//j_security_check'>" + ( ( "<input<seq2seq4repair_space>type='text'<seq2seq4repair_space>name='j_username'//>" + "<input<seq2seq4repair_space>type='password'<seq2seq4repair_space>name='j_password'//>" ) + "<input<seq2seq4repair_space>type='submit'<seq2seq4repair_space>value='Login'//><//form>" ) ) ; WebServer . addRestController ( "//get" , ( request , response ) -> { if ( request . getMethod ( ) . equals ( WebServer . METHOD_GET ) ) { HashMap < String , String > ret = new HashMap < > ( ) ; ret . put ( "key1" , "val1" ) ; ret . put ( "key2" , "val2" ) ; return ret ; } throw new WebServerException ( "Unsupported<seq2seq4repair_space>method" ) ; } ) ; WebServer . addRestController ( "//rest//put" , ObjectDTO . class , ( request , response , postObject ) -> { if ( request . getMethod ( ) . equals ( WebServer . METHOD_PUT ) ) { return postObject ; } throw new WebServerException ( "Unsupported<seq2seq4repair_space>method" ) ; } ) ; File . writeString ( "hello.world=Hello<seq2seq4repair_space>world" , "tmp//locale.properties" ) ; WebServer . addTemplates ( "tmp" , 0 , "tmp//locale.properties" ) ; File . writeString ( "<html><body><span<seq2seq4repair_space>th:text=\"${varName}\"><//span><span<seq2seq4repair_space>th:text=\"#{hello.world}\"><//span><//body><html>" , "tmp//example.html" ) ; WebServer . addController ( "//index" , ( request , response , model ) -> { model . put ( "varName" , new Integer ( "123" ) ) ; return "example" ; } ) ; WebServer . start ( ) ; assertEquals ( "123" , URL . getAllToString ( "http:////localhost:8181//static//webserver.txt" ) ) ; assertEquals ( "Bla-Bla" , URL . getAllToString ( "http:////localhost:8181//script" ) ) ; try { URL . getAllToString ( "https:////localhost:8282//script" ) ; assertTrue ( false ) ; } catch ( Exception e ) { assertTrue ( true ) ; } URL . turnOffCertificateValidation ( ) ; assertEquals ( "Bla-Bla" , URL . getAllToString ( "https:////localhost:8282//script" ) ) ; assertEquals ( "{\"key1\":\"val1\",\"key2\":\"val2\"}" , URL . getAllToString ( "http:////localhost:8181//get" ) ) ; ObjectDTO o = new ObjectDTO ( ) ; o . setName ( "a" ) ; o . setSalary ( 1 ) ; assertEquals ( JSON . toString ( o ) , URL . getAllToString ( "http:////localhost:8181//rest//put" , METHOD_PUT , null , JSON . toString ( o ) ) ) ; assertEquals ( "<html><head><//head><body><span>123<//span><span>Hello<seq2seq4repair_space>world<//span><//body><//html>" , URL . getAllToString ( "http:////localhost:8181//index" ) ) ; assertNotEquals ( "new<seq2seq4repair_space>new" , URL . getAllToString ( "http:////localhost:8181//new" ) ) ; WebServer . stop ( ) ; } }

Fix:
WebServer . https ( "localhost" , 8282 , "src//test//resources//key.jks" , "storepwd" , "keypwd" ) ;