|
18 | 18 | import java.net.InetSocketAddress; |
19 | 19 | import java.net.Socket; |
20 | 20 | import java.nio.ByteBuffer; |
| 21 | +import org.apache.logging.log4j.LogManager; |
| 22 | +import org.apache.logging.log4j.Logger; |
21 | 23 |
|
22 | 24 | public class TimingProxyClientTcpTransportHandler extends ClientTcpTransportHandler |
23 | 25 | implements ProxyableTransportHandler, TimeableTransportHandler { |
24 | 26 |
|
| 27 | + private static final Logger LOGGER = LogManager.getLogger(); |
| 28 | + |
25 | 29 | protected Socket controlSocket; |
26 | 30 | protected String proxyDataHostName = "127.0.0.1"; |
27 | 31 | protected int proxyDataPort = 4444; |
@@ -51,7 +55,6 @@ public byte[] fetchData() throws IOException { |
51 | 55 | throw new IOException("Should return 64 bit unsigned int"); |
52 | 56 | } |
53 | 57 | measurement = ByteBuffer.wrap(controlData).getLong(); |
54 | | - |
55 | 58 | } |
56 | 59 | return data; |
57 | 60 | } |
@@ -83,12 +86,13 @@ public void initialize() throws IOException { |
83 | 86 | controlSocket = new Socket(); |
84 | 87 | controlSocket.connect(new InetSocketAddress(proxyControlHostName, proxyControlPort), (int) connectionTimeout); |
85 | 88 | cachedSocketState = null; |
86 | | - super.initialize(); |
87 | | - |
88 | 89 | /* tell the proxy where the real server is */ |
89 | 90 | controlSocket.getOutputStream().write((hostname + "\n").getBytes()); |
90 | 91 | controlSocket.getOutputStream().write((Integer.toString(dstPort) + "\n").getBytes()); |
91 | 92 | controlSocket.getOutputStream().flush(); |
| 93 | + hostname = proxyDataHostName; |
| 94 | + dstPort = proxyDataPort; |
| 95 | + super.initialize(); |
92 | 96 | } |
93 | 97 |
|
94 | 98 | @Override |
|
0 commit comments