Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,16 @@ private Connection(ConnectionManager mgr, String host, @Nullable SSLProvider ssl
this.proxySSLProvider = proxySSLProvider;
}

public boolean isSame(String host, int port) {
return socket != null && host.equals(this.host) && port == socket.getPort();
}
/**
* Checks whether the (host,port) combination matches this combination.
*
* This does not directly check whether the same proxy is used, but that is actually irrelevant, since
* proxyConfiguration is constant per HttpClient and ergo per ConnectionManager. Since only Connections
* opened by the same HttpClient are managed by the same ConnectionManager, this is sufficient.
*/
public boolean isSame(String host, int port) {
return socket != null && host.equals(this.host) && port == socket.getPort();
}

public void close() throws IOException {
if (socket == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void tearDown() throws Exception {

@Test
public void testIsSame() {
assertTrue(conLocalhost.isSame("127.0.0.1", 2000));
assertTrue(con127_0_0_1.isSame("localhost", 2000));
assertTrue(conLocalhost.isSame("localhost", 2000));
assertTrue(con127_0_0_1.isSame("127.0.0.1", 2000));
}
}
1 change: 1 addition & 0 deletions docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Grafana Dashboard: Complete Dashboard for Membrane with documentation in examples/monitoring/grafana
- Remove GroovyTemplateInterceptor (Not Template Interceptor)
- Old an unused
- create test asserting that connection reuse via proxy works

# 7.0.4

Expand Down