less brittle test
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@890 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
df989b3141
commit
22cb389992
|
@ -14,6 +14,8 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -26,12 +28,17 @@ public class ConnectionFailedTest extends TestCase
|
|||
{
|
||||
public void testConnectionFailed() throws Exception
|
||||
{
|
||||
ServerSocket socket = new ServerSocket();
|
||||
socket.bind(null);
|
||||
int port=socket.getLocalPort();
|
||||
socket.close();
|
||||
|
||||
HttpClient httpClient = new HttpClient();
|
||||
httpClient.start();
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
HttpExchange exchange = new ConnectionFailedExchange(latch);
|
||||
exchange.setAddress(new Address("localhost", 8080));
|
||||
exchange.setAddress(new Address("localhost", port));
|
||||
exchange.setURI("/");
|
||||
|
||||
httpClient.send(exchange);
|
||||
|
|
|
@ -65,6 +65,11 @@ import org.eclipse.jetty.util.thread.Timeout;
|
|||
* a connection. Where appropriate, allocated buffers are also kept associated
|
||||
* with the connection via the parser and/or generator.
|
||||
* </p>
|
||||
* <p>
|
||||
* The connection state is held by 3 separate state machines: The request state, the
|
||||
* response state and the continuation state. All three state machines must be driven
|
||||
* to completion for every request, and all three can complete in any order.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class HttpConnection implements Connection
|
||||
|
|
Loading…
Reference in New Issue