}
public void testServletPost() throws Exception
{
Server server=new Server();
SslSelectChannelConnector connector=new SslSelectChannelConnector();
String keystore = System.getProperty("user.dir")+File.separator+"src"+File.separator+"test"+File.separator+"resources"+File.separator+"keystore";
connector.setPort(0);
connector.setKeystore(keystore);
connector.setPassword("storepwd");
connector.setKeyPassword("keypwd");
connector.setTruststore(keystore);
connector.setTrustPassword("storepwd");
server.setConnectors(new Connector[]
{ connector });
ServletHandler handler = new ServletHandler();
TestServlet servlet = new TestServlet();
handler.addServletWithMapping(new ServletHolder(servlet),"/test");
server.addHandler(handler);
try
{
SSLContext context = SSLContext.getInstance("SSL");
context.init(null,s_dummyTrustManagers,new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
server.start();
URL url = new URL("https://localhost:"+connector.getLocalPort()+"/test");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
if (conn instanceof HttpsURLConnection)
{
((HttpsURLConnection)conn).setHostnameVerifier(new HostnameVerifier()