Spring

Tips and tricks

RestTemplate through socks5 / ssh tunnel (kotlin)

val restTemplate = RestTemplate()
val factory = SimpleClientHttpRequestFactory()

val socksport = 1088
val address = InetSocketAddress("localhost", socksport)
val proxy = Proxy(Proxy.Type.SOCKS, address)
factory.setProxy(proxy)
restTemplate.setRequestFactory(factory)