fixes for merge from 11 to 12
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
69360b80fd
commit
46b1959c9d
|
@ -53,7 +53,6 @@ import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.FuturePromise;
|
import org.eclipse.jetty.util.FuturePromise;
|
||||||
import org.eclipse.jetty.util.Jetty;
|
import org.eclipse.jetty.util.Jetty;
|
||||||
import org.eclipse.jetty.util.Promise;
|
import org.eclipse.jetty.util.Promise;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
|
||||||
import org.eclipse.jetty.util.component.Graceful;
|
import org.eclipse.jetty.util.component.Graceful;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -994,7 +993,7 @@ public class HTTP2Test extends AbstractTest
|
||||||
|
|
||||||
CompletableFuture<Throwable> serverFailureFuture = new CompletableFuture<>();
|
CompletableFuture<Throwable> serverFailureFuture = new CompletableFuture<>();
|
||||||
CompletableFuture<String> serverCloseReasonFuture = new CompletableFuture<>();
|
CompletableFuture<String> serverCloseReasonFuture = new CompletableFuture<>();
|
||||||
start(new ServerSessionListener.Adapter()
|
start(new ServerSessionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSettings(Session session, SettingsFrame frame)
|
public void onSettings(Session session, SettingsFrame frame)
|
||||||
|
@ -1003,21 +1002,23 @@ public class HTTP2Test extends AbstractTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Session session, Throwable failure)
|
public void onFailure(Session session, Throwable failure, Callback callback)
|
||||||
{
|
{
|
||||||
serverFailureFuture.complete(failure);
|
serverFailureFuture.complete(failure);
|
||||||
|
ServerSessionListener.super.onFailure(session, failure, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Session session, GoAwayFrame frame)
|
public void onClose(Session session, GoAwayFrame frame, Callback callback)
|
||||||
{
|
{
|
||||||
serverCloseReasonFuture.complete(frame.tryConvertPayload());
|
serverCloseReasonFuture.complete(frame.tryConvertPayload());
|
||||||
|
ServerSessionListener.super.onClose(session, frame, callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CompletableFuture<Throwable> clientFailureFuture = new CompletableFuture<>();
|
CompletableFuture<Throwable> clientFailureFuture = new CompletableFuture<>();
|
||||||
CompletableFuture<String> clientCloseReasonFuture = new CompletableFuture<>();
|
CompletableFuture<String> clientCloseReasonFuture = new CompletableFuture<>();
|
||||||
Session.Listener.Adapter listener = new Session.Listener.Adapter()
|
Session.Listener listener = new Session.Listener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSettings(Session session, SettingsFrame frame)
|
public void onSettings(Session session, SettingsFrame frame)
|
||||||
|
@ -1026,28 +1027,30 @@ public class HTTP2Test extends AbstractTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Session session, Throwable failure)
|
public void onFailure(Session session, Throwable failure, Callback callback)
|
||||||
{
|
{
|
||||||
clientFailureFuture.complete(failure);
|
clientFailureFuture.complete(failure);
|
||||||
|
Session.Listener.super.onFailure(session, failure, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Session session, GoAwayFrame frame)
|
public void onClose(Session session, GoAwayFrame frame, Callback callback)
|
||||||
{
|
{
|
||||||
clientCloseReasonFuture.complete(frame.tryConvertPayload());
|
clientCloseReasonFuture.complete(frame.tryConvertPayload());
|
||||||
|
Session.Listener.super.onClose(session, frame, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HTTP2Session session = (HTTP2Session)newClient(listener);
|
HTTP2Session session = (HTTP2Session)newClientSession(listener);
|
||||||
assertTrue(settingsLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(settingsLatch.await(5, TimeUnit.SECONDS));
|
||||||
session.getGenerator().getHpackEncoder().setMaxHeaderListSize(1024 * 1024);
|
session.getGenerator().getHpackEncoder().setMaxHeaderListSize(1024 * 1024);
|
||||||
|
|
||||||
String value = StringUtil.stringFrom("x", 8 * 1024);
|
String value = "x".repeat(8 * 1024);
|
||||||
HttpFields requestFields = HttpFields.build()
|
HttpFields requestFields = HttpFields.build()
|
||||||
.put("custom", value);
|
.put("custom", value);
|
||||||
MetaData.Request metaData = newRequest("GET", requestFields);
|
MetaData.Request metaData = newRequest("GET", requestFields);
|
||||||
HeadersFrame request = new HeadersFrame(metaData, null, true);
|
HeadersFrame request = new HeadersFrame(metaData, null, true);
|
||||||
session.newStream(request, new FuturePromise<>(), new Stream.Listener.Adapter());
|
session.newStream(request, new FuturePromise<>(), new Stream.Listener(){});
|
||||||
|
|
||||||
// Test failure and close reason on client.
|
// Test failure and close reason on client.
|
||||||
String closeReason = clientCloseReasonFuture.get(5, TimeUnit.SECONDS);
|
String closeReason = clientCloseReasonFuture.get(5, TimeUnit.SECONDS);
|
||||||
|
@ -1067,7 +1070,7 @@ public class HTTP2Test extends AbstractTest
|
||||||
{
|
{
|
||||||
CompletableFuture<Throwable> serverFailureFuture = new CompletableFuture<>();
|
CompletableFuture<Throwable> serverFailureFuture = new CompletableFuture<>();
|
||||||
CompletableFuture<String> serverCloseReasonFuture = new CompletableFuture<>();
|
CompletableFuture<String> serverCloseReasonFuture = new CompletableFuture<>();
|
||||||
start(new ServerSessionListener.Adapter()
|
start(new ServerSessionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)
|
public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)
|
||||||
|
@ -1075,47 +1078,51 @@ public class HTTP2Test extends AbstractTest
|
||||||
HTTP2Session session = (HTTP2Session)stream.getSession();
|
HTTP2Session session = (HTTP2Session)stream.getSession();
|
||||||
session.getGenerator().getHpackEncoder().setMaxHeaderListSize(1024 * 1024);
|
session.getGenerator().getHpackEncoder().setMaxHeaderListSize(1024 * 1024);
|
||||||
|
|
||||||
String value = StringUtil.stringFrom("x", 8 * 1024);
|
String value = "x".repeat(8 * 1024);
|
||||||
HttpFields fields = HttpFields.build().put("custom", value);
|
HttpFields fields = HttpFields.build().put("custom", value);
|
||||||
MetaData.Response response = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, fields);
|
MetaData.Response response = new MetaData.Response(HttpStatus.OK_200, null, HttpVersion.HTTP_2, fields);
|
||||||
stream.headers(new HeadersFrame(stream.getId(), response, null, true));
|
stream.headers(new HeadersFrame(stream.getId(), response, null, true));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Session session, Throwable failure)
|
public void onFailure(Session session, Throwable failure, Callback callback)
|
||||||
{
|
{
|
||||||
serverFailureFuture.complete(failure);
|
serverFailureFuture.complete(failure);
|
||||||
|
ServerSessionListener.super.onFailure(session, failure, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Session session, GoAwayFrame frame)
|
public void onClose(Session session, GoAwayFrame frame, Callback callback)
|
||||||
{
|
{
|
||||||
serverCloseReasonFuture.complete(frame.tryConvertPayload());
|
serverCloseReasonFuture.complete(frame.tryConvertPayload());
|
||||||
|
ServerSessionListener.super.onClose(session, frame, callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CompletableFuture<Throwable> clientFailureFuture = new CompletableFuture<>();
|
CompletableFuture<Throwable> clientFailureFuture = new CompletableFuture<>();
|
||||||
CompletableFuture<String> clientCloseReasonFuture = new CompletableFuture<>();
|
CompletableFuture<String> clientCloseReasonFuture = new CompletableFuture<>();
|
||||||
Session.Listener.Adapter listener = new Session.Listener.Adapter()
|
Session.Listener listener = new Session.Listener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Session session, Throwable failure)
|
public void onFailure(Session session, Throwable failure, Callback callback)
|
||||||
{
|
{
|
||||||
clientFailureFuture.complete(failure);
|
clientFailureFuture.complete(failure);
|
||||||
|
Session.Listener.super.onFailure(session, failure, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Session session, GoAwayFrame frame)
|
public void onClose(Session session, GoAwayFrame frame, Callback callback)
|
||||||
{
|
{
|
||||||
clientCloseReasonFuture.complete(frame.tryConvertPayload());
|
clientCloseReasonFuture.complete(frame.tryConvertPayload());
|
||||||
|
Session.Listener.super.onClose(session, frame, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Session session = newClient(listener);
|
Session session = newClientSession(listener);
|
||||||
MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY);
|
MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY);
|
||||||
HeadersFrame request = new HeadersFrame(metaData, null, true);
|
HeadersFrame request = new HeadersFrame(metaData, null, true);
|
||||||
session.newStream(request, new FuturePromise<>(), new Stream.Listener.Adapter());
|
session.newStream(request, new FuturePromise<>(), new Stream.Listener(){});
|
||||||
|
|
||||||
// Test failure and close reason on server.
|
// Test failure and close reason on server.
|
||||||
String closeReason = serverCloseReasonFuture.get(5, TimeUnit.SECONDS);
|
String closeReason = serverCloseReasonFuture.get(5, TimeUnit.SECONDS);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.util.ArrayList;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -66,6 +66,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
|
import static org.awaitility.Awaitility.await;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
Loading…
Reference in New Issue