diff options
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPSession.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPSession.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPSession.java b/src/main/java/com/lumaserv/bgp/BGPSession.java index 21a5564..c6a8cd2 100644 --- a/src/main/java/com/lumaserv/bgp/BGPSession.java +++ b/src/main/java/com/lumaserv/bgp/BGPSession.java @@ -47,6 +47,10 @@ public class BGPSession implements Runnable { this.port = port; } + public void automaticStop() { + fsm.getCurrentState().automaticStop(); + } + public void keepAlive() { try { outputStream.write(new BGPPacket().setType(BGPPacket.Type.KEEPALIVE).setMessage(new byte[0]).build()); @@ -94,6 +98,10 @@ public class BGPSession implements Runnable { thread.start(); } + void sendNotification(BGPNotification notification) throws IOException { + outputStream.write(new BGPPacket().setType(BGPPacket.Type.NOTIFICATION).setMessage(notification.build()).build()); + } + void sendOpen(BGPOpen request) throws IOException { outputStream.write(new BGPPacket().setType(BGPPacket.Type.OPEN).setMessage(request.build()).build()); System.out.println("Sent open"); @@ -167,9 +175,10 @@ System.out.println("Sent open"); } System.out.println("Closed!"); } catch (IOException ex) { - if (!closed) + if (!closed) { fsm.getCurrentState().tcpConnectionFails(); - ex.printStackTrace(); + ex.printStackTrace(); + } closed = true; configuration.getListener().onClose(this); } |