368821 improved test harness
This commit is contained in:
parent
3e04cac272
commit
c696f14450
|
@ -43,16 +43,18 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||||
import org.eclipse.jetty.toolchain.test.OS;
|
import org.eclipse.jetty.toolchain.test.OS;
|
||||||
|
import org.eclipse.jetty.util.component.Dumpable;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Assume;
|
import org.junit.Assume;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.hamcrest.Matchers.lessThan;
|
import static org.hamcrest.Matchers.lessThan;
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.hamcrest.Matchers.not;
|
||||||
|
|
||||||
public class SslBytesServerTest extends SslBytesTest
|
public class SslBytesServerTest extends SslBytesTest
|
||||||
{
|
{
|
||||||
|
@ -1566,6 +1568,8 @@ public class SslBytesServerTest extends SslBytesTest
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
if (latch.getCount()==0)
|
||||||
|
return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Send request
|
// Send request
|
||||||
|
@ -1578,8 +1582,7 @@ public class SslBytesServerTest extends SslBytesTest
|
||||||
}
|
}
|
||||||
catch (Exception x)
|
catch (Exception x)
|
||||||
{
|
{
|
||||||
// Latch won't trigger and test will
|
// Latch won't trigger and test will fail
|
||||||
// fail, just print the stack trace
|
|
||||||
x.printStackTrace();
|
x.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1608,6 +1611,15 @@ public class SslBytesServerTest extends SslBytesTest
|
||||||
Assert.assertThat(sslFlushes.get(), lessThan(20));
|
Assert.assertThat(sslFlushes.get(), lessThan(20));
|
||||||
Assert.assertThat(httpParses.get(), lessThan(50));
|
Assert.assertThat(httpParses.get(), lessThan(50));
|
||||||
|
|
||||||
|
//System.err.println(((Dumpable)server.getConnectors()[0]).dump());
|
||||||
|
Assert.assertThat(((Dumpable)server.getConnectors()[0]).dump(),containsString("SCEP@"));
|
||||||
|
|
||||||
|
completeClose(client);
|
||||||
|
|
||||||
|
TimeUnit.MILLISECONDS.sleep(200);
|
||||||
|
//System.err.println(((Dumpable)server.getConnectors()[0]).dump());
|
||||||
|
Assert.assertThat(((Dumpable)server.getConnectors()[0]).dump(),not(containsString("SCEP@")));
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@Test
|
@Test
|
||||||
|
@ -1718,9 +1730,28 @@ public class SslBytesServerTest extends SslBytesTest
|
||||||
// Close Alert
|
// Close Alert
|
||||||
record = proxy.readFromServer();
|
record = proxy.readFromServer();
|
||||||
proxy.flushToClient(record);
|
proxy.flushToClient(record);
|
||||||
|
|
||||||
// Socket close
|
// Socket close
|
||||||
record = proxy.readFromServer();
|
record = proxy.readFromServer();
|
||||||
Assert.assertNull(String.valueOf(record), record);
|
Assert.assertNull(String.valueOf(record), record);
|
||||||
proxy.flushToClient(record);
|
proxy.flushToClient(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void completeClose(SSLSocket client) throws Exception
|
||||||
|
{
|
||||||
|
client.close();
|
||||||
|
|
||||||
|
// Close Alert
|
||||||
|
TLSRecord record = proxy.readFromClient();
|
||||||
|
proxy.flushToServer(record);
|
||||||
|
// Socket close
|
||||||
|
record = proxy.readFromClient();
|
||||||
|
Assert.assertNull(String.valueOf(record), record);
|
||||||
|
proxy.flushToServer(record);
|
||||||
|
|
||||||
|
// Close Alert
|
||||||
|
record = proxy.readFromServer();
|
||||||
|
proxy.flushToClient(record);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue