From d2fdb1697dfcd67540553a2933daa7f63da20d0d Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 8 Mar 2023 22:43:26 +0100 Subject: Use socketfactory and allow caller supplied serversocket To allow using TrafficStats to tag sockets on Android. --- src/main/java/com/lumaserv/bgp/BGPSession.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/lumaserv/bgp/BGPSession.java') diff --git a/src/main/java/com/lumaserv/bgp/BGPSession.java b/src/main/java/com/lumaserv/bgp/BGPSession.java index dd2b7ff..bd40c13 100644 --- a/src/main/java/com/lumaserv/bgp/BGPSession.java +++ b/src/main/java/com/lumaserv/bgp/BGPSession.java @@ -204,17 +204,17 @@ System.out.println("Sent open"); if (socket == null) { while (true) { try { - System.out.println("Outgoing"); - socket = new Socket(); - socket.connect(new InetSocketAddress(host, port)); + System.out.println("Outgoing: " + host + ":" + port); + socket = configuration.getSocketFactory().createSocket(host, port); break; } catch(IOException ex) { + System.out.println("Exception: " + ex); if (closed) { throw new IOException("Closed", ex); } } } - System.out.println("Outgoing accepted"); + System.out.println("Outgoing accepted: " + socket.isConnected()); inputStream = socket.getInputStream(); outputStream = socket.getOutputStream(); fsm.getCurrentState().tcpCRAcked(); -- cgit v1.2.3