398467 Servlet 3.1 Non Blocking IO

fixed more tests
This commit is contained in:
Greg Wilkins 2013-07-11 15:57:42 +10:00
parent 56f2f9c93f
commit cd97b3dcbf
5 changed files with 27 additions and 5 deletions

View File

@ -18,6 +18,9 @@
package org.eclipse.jetty.client.ssl;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.File;
@ -68,7 +71,6 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.OS;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
@ -1868,6 +1870,11 @@ public class SslBytesServerTest extends SslBytesTest
// Socket close
record = proxy.readFromServer();
Assert.assertThat(record,Matchers.notNullValue());
if (record!=null)
{
Assert.assertEquals(record.getType(),Type.ALERT);
record = proxy.readFromServer();
}
Assert.assertThat(record,nullValue());
}
}

View File

@ -1210,6 +1210,11 @@ public class HttpParser
case CLOSED:
break;
case START:
_handler.earlyEOF();
setState(State.CLOSED);
break;
case END:
setState(State.CLOSED);
break;

View File

@ -645,7 +645,7 @@ public class HttpChannelState
}
if (handle)
_channel.handle();
_channel.execute(_channel);
}
public void onWritePossible()
@ -659,7 +659,7 @@ public class HttpChannelState
}
if (handle)
_channel.handle();
_channel.execute(_channel);
}
public class AsyncTimeout implements Runnable

View File

@ -402,6 +402,16 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
super(connector,config,endPoint,transport,input);
}
@Override
public void earlyEOF()
{
// If we have no request yet, just close
if (getRequest().getMethod()==null)
close();
else
super.earlyEOF();
}
@Override
public boolean content(ByteBuffer item)
{

View File

@ -94,7 +94,7 @@ public class ConnectionOpenCloseTest extends AbstractHttpTest
socket.shutdownOutput();
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
String response=IO.toString(socket.getInputStream());
Assert.assertThat(response,Matchers.containsString("400 Bad"));
Assert.assertEquals(0,response.length());
// Wait some time to see if the callbacks are called too many times
TimeUnit.MILLISECONDS.sleep(200);