@@ -0,0 +1,3239 @@
+package fi.iki.elonen;%0A%0A/*%0A * #%25L%0A * NanoHttpd-Core%0A * %25%25%0A * Copyright (C) 2012 - 2015 nanohttpd%0A * %25%25%0A * Redistribution and use in source and binary forms, with or without modification,%0A * are permitted provided that the following conditions are met:%0A *%0A * 1. Redistributions of source code must retain the above copyright notice, this%0A *    list of conditions and the following disclaimer.%0A *%0A * 2. Redistributions in binary form must reproduce the above copyright notice,%0A *    this list of conditions and the following disclaimer in the documentation%0A *    and/or other materials provided with the distribution.%0A *%0A * 3. Neither the name of the nanohttpd nor the names of its contributors%0A *    may be used to endorse or promote products derived from this software without%0A *    specific prior written permission.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22 AND%0A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED%0A * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.%0A * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,%0A * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,%0A * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF%0A * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE%0A * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED%0A * OF THE POSSIBILITY OF SUCH DAMAGE.%0A * #L%25%0A */%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0A%0Aimport javax.net.ssl.SSLServerSocketFactory;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0A%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertNull;%0A%0Apublic class LoadKeyStoreTest %7B%0A%0A    @Rule%0A    public ExpectedException thrown = ExpectedException.none();%0A%0A    @Test%0A    public void loadKeyStoreFromResources() throws Exception %7B%0A        String keyStorePath = %22/keystore.jks%22;%0A        InputStream resourceAsStream = this.getClass().getResourceAsStream(keyStorePath);%0A        assertNotNull(resourceAsStream);%0A%0A        SSLServerSocketFactory sslServerSocketFactory = NanoHTTPD.makeSSLSocketFactory(keyStorePath, %22password%22.toCharArray());%0A        assertNotNull(sslServerSocketFactory);%0A    %7D%0A%0A    @Test%0A    public void loadKeyStoreFromResourcesWrongPassword() throws Exception %7B%0A        String keyStorePath = %22/keystore.jks%22;%0A        InputStream resourceAsStream = this.getClass().getResourceAsStream(keyStorePath);%0A        assertNotNull(resourceAsStream);%0A%0A        thrown.expect(IOException.class);%0A        NanoHTTPD.makeSSLSocketFactory(keyStorePath, %22wrongpassword%22.toCharArray());%0A    %7D%0A%0A    @Test%0A    public void loadNonExistentKeyStoreFromResources() throws Exception %7B%0A        String nonExistentPath = %22/nokeystorehere.jks%22;%0A        InputStream resourceAsStream = this.getClass().getResourceAsStream(nonExistentPath);%0A        assertNull(resourceAsStream);%0A%0A        thrown.expect(IOException.class);%0A        NanoHTTPD.makeSSLSocketFactory(nonExistentPath, %22%22.toCharArray());%0A    %7D%0A%0A%7D%0A

add unit tests for loading keystore from resources path