From db773ef9073a4d69effb3419d56fe3796a75b46e Mon Sep 17 00:00:00 2001 From: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Date: Tue, 9 Apr 2024 02:04:41 +0900 Subject: [PATCH] Fix Jetty 12 connection metrics test setup --- .../io/micrometer/jetty12/JettyConnectionMetricsTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/micrometer-jetty12/src/test/java/io/micrometer/jetty12/JettyConnectionMetricsTest.java b/micrometer-jetty12/src/test/java/io/micrometer/jetty12/JettyConnectionMetricsTest.java index 1aaa763b2a..46f806a0eb 100644 --- a/micrometer-jetty12/src/test/java/io/micrometer/jetty12/JettyConnectionMetricsTest.java +++ b/micrometer-jetty12/src/test/java/io/micrometer/jetty12/JettyConnectionMetricsTest.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.client.Request; import org.eclipse.jetty.client.StringRequestContent; import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.NetworkTrafficServerConnector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.util.component.LifeCycle; @@ -45,12 +46,14 @@ class JettyConnectionMetricsTest { private Server server = new Server(0); - private ServerConnector connector = new ServerConnector(server); + private NetworkTrafficServerConnector connector = new NetworkTrafficServerConnector(server); private CloseableHttpClient client = HttpClients.createDefault(); void setup() throws Exception { - connector.addBean(new JettyConnectionMetrics(registry)); + JettyConnectionMetrics metrics = new JettyConnectionMetrics(registry); + connector.addBean(metrics); + connector.setNetworkTrafficListener(metrics); server.setConnectors(new Connector[] { connector }); server.start(); }