294563 fixed race in test
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1509 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
2daf72ff1e
commit
fcd0c6a119
|
@ -109,6 +109,7 @@ public class WebSocketUpgradeTest extends TestCase
|
||||||
@Override
|
@Override
|
||||||
protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException
|
protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException
|
||||||
{
|
{
|
||||||
|
waitFor(2);
|
||||||
_results.add(new Integer(status));
|
_results.add(new Integer(status));
|
||||||
super.onResponseStatus(version,status,reason);
|
super.onResponseStatus(version,status,reason);
|
||||||
}
|
}
|
||||||
|
@ -120,22 +121,27 @@ public class WebSocketUpgradeTest extends TestCase
|
||||||
@Override
|
@Override
|
||||||
protected Connection onSwitchProtocol(EndPoint endp) throws IOException
|
protected Connection onSwitchProtocol(EndPoint endp) throws IOException
|
||||||
{
|
{
|
||||||
|
waitFor(3);
|
||||||
WebSocketConnection connection = new WebSocketConnection(clientWS,endp);
|
WebSocketConnection connection = new WebSocketConnection(clientWS,endp);
|
||||||
// wait for 101.
|
|
||||||
|
_results.add("onSwitchProtocol");
|
||||||
|
_results.add(connection);
|
||||||
|
clientWS.onConnect(connection);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void waitFor(int results)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int c=10;
|
int c=10;
|
||||||
while(_results.size()==0 && c-->0)
|
while(_results.size()<results && c-->0)
|
||||||
Thread.sleep(100);
|
Thread.sleep(10);
|
||||||
}
|
}
|
||||||
catch(InterruptedException e)
|
catch(InterruptedException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
_results.add("onSwitchProtocol");
|
|
||||||
_results.add(connection);
|
|
||||||
clientWS.onConnect(connection);
|
|
||||||
return connection;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue