jetty-9 write on ssl connection test harness
This commit is contained in:
parent
16b404754e
commit
97ff08b3be
|
@ -38,6 +38,8 @@ public class SslConnectionTest
|
||||||
private static ByteBufferPool __byteBufferPool = new StandardByteBufferPool();
|
private static ByteBufferPool __byteBufferPool = new StandardByteBufferPool();
|
||||||
|
|
||||||
protected volatile EndPoint _lastEndp;
|
protected volatile EndPoint _lastEndp;
|
||||||
|
private volatile boolean _testFill=true;
|
||||||
|
private volatile FutureCallback<Void> _writeCallback;
|
||||||
protected ServerSocketChannel _connector;
|
protected ServerSocketChannel _connector;
|
||||||
protected QueuedThreadPool _threadPool = new QueuedThreadPool();
|
protected QueuedThreadPool _threadPool = new QueuedThreadPool();
|
||||||
protected ScheduledExecutorService _scheduler = Executors.newSingleThreadScheduledExecutor();
|
protected ScheduledExecutorService _scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
@ -88,6 +90,8 @@ public class SslConnectionTest
|
||||||
@Before
|
@Before
|
||||||
public void startManager() throws Exception
|
public void startManager() throws Exception
|
||||||
{
|
{
|
||||||
|
_testFill=true;
|
||||||
|
_writeCallback=null;
|
||||||
_lastEndp=null;
|
_lastEndp=null;
|
||||||
_connector = ServerSocketChannel.open();
|
_connector = ServerSocketChannel.open();
|
||||||
_connector.socket().bind(null);
|
_connector.socket().bind(null);
|
||||||
|
@ -118,7 +122,10 @@ public class SslConnectionTest
|
||||||
public void onOpen()
|
public void onOpen()
|
||||||
{
|
{
|
||||||
super.onOpen();
|
super.onOpen();
|
||||||
|
if (_testFill)
|
||||||
fillInterested();
|
fillInterested();
|
||||||
|
else
|
||||||
|
getEndPoint().write(null,_writeCallback,BufferUtil.toBuffer("Hello Client"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -204,6 +211,29 @@ public class SslConnectionTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWriteOnConnect() throws Exception
|
||||||
|
{
|
||||||
|
_testFill=false;
|
||||||
|
|
||||||
|
for (int i=0;i<10;i++)
|
||||||
|
{
|
||||||
|
_writeCallback = new FutureCallback<>();
|
||||||
|
Socket client = newClient();
|
||||||
|
client.setSoTimeout(60000);
|
||||||
|
|
||||||
|
SocketChannel server = _connector.accept();
|
||||||
|
server.configureBlocking(false);
|
||||||
|
_manager.accept(server);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int len=client.getInputStream().read(buffer);
|
||||||
|
Assert.assertEquals("Hello Client",new String(buffer,0,len,StringUtil.__UTF8_CHARSET));
|
||||||
|
Assert.assertEquals(null,_writeCallback.get(100,TimeUnit.MILLISECONDS));
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testManyLines() throws Exception
|
public void testManyLines() throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue