summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPServer.java4
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPSession.java8
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPSessionConfiguration.java3
3 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPServer.java b/src/main/java/com/lumaserv/bgp/BGPServer.java
index 53f8af7..265b138 100644
--- a/src/main/java/com/lumaserv/bgp/BGPServer.java
+++ b/src/main/java/com/lumaserv/bgp/BGPServer.java
@@ -26,6 +26,10 @@ public class BGPServer implements Runnable {
serverSocket = new ServerSocket(port);
}
+ public BGPServer(ServerSocket serverSocket) {
+ this.serverSocket = serverSocket;
+ }
+
private static boolean checkEqual(byte[] a, byte[] b) {
if(a == b)
return true;
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();
diff --git a/src/main/java/com/lumaserv/bgp/BGPSessionConfiguration.java b/src/main/java/com/lumaserv/bgp/BGPSessionConfiguration.java
index 9c24d0a..2c76615 100644
--- a/src/main/java/com/lumaserv/bgp/BGPSessionConfiguration.java
+++ b/src/main/java/com/lumaserv/bgp/BGPSessionConfiguration.java
@@ -6,6 +6,8 @@ import lombok.Setter;
import java.net.InetAddress;
+import javax.net.SocketFactory;
+
@AllArgsConstructor
@Setter
@Getter
@@ -17,5 +19,6 @@ public class BGPSessionConfiguration {
int remoteAs;
byte[] remoteIdentifier;
InetAddress remoteAddr;
+ SocketFactory socketFactory;
BGPListener listener;
}