Skip to content

Commit

Permalink
Fix Jetty 12 connection metrics test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
shakuzen committed Apr 8, 2024
1 parent 0fce7ef commit db773ef
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down

0 comments on commit db773ef

Please sign in to comment.