DefaultProxyConnectProtocol extends AbstractProxyProtocol<ProxyConnectProtocolParser> implements ProxyConnectProtocol { @Override public String getSource() { ForwardForOptionParser forwardForOptionParser = (ForwardForOptionParser) parser .getProxyOptionParser(PROXY_OPTION.FORWARD_FOR); if(forwardForOptionParser == null) { return UNKNOWN_SOURCE; } String forwardFor = forwardForOptionParser.output(); if(forwardFor == null || forwardFor.isEmpty()) { return UNKNOWN_SOURCE; } String[] paths = forwardForOptionParser.output().split(AbstractProxyOptionParser.WHITE_SPACE); if(paths.length < 2) { return UNKNOWN_SOURCE; } return paths[1]; } DefaultProxyConnectProtocol(ProxyConnectProtocolParser parser); @Override List<ProxyEndpoint> nextEndpoints(); @Override void recordForwardFor(InetSocketAddress address); @Override String getForwardFor(); @Override void setContent(String content); @Override String getContent(); @Override String getRouteInfo(); @Override String getFinalStation(); @Override String getSource(); @Override boolean isCompressed(); @Override CompressAlgorithm getCompressAlgorithm(); @Override void removeCompressOptionIfExist(); @Override void addCompression(CompressAlgorithm algorithm); @Override String toString();  }
@Test public void testGetSource() { Assert.assertEquals("10.5.109.209:41085", protocol.getSource()); }