Initial framework migration to netty.
[bgpcep.git] / bgp / rib-impl / src / test / java / org / opendaylight / protocol / bgp / rib / impl / SpeakerSessionMock.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.rib.impl;
9
10 import java.util.Timer;
11
12 import org.opendaylight.protocol.bgp.parser.BGPMessage;
13 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
15 import org.opendaylight.protocol.concepts.ASNumber;
16
17 /**
18  * Mock of the BGP speakers session.
19  */
20 public class SpeakerSessionMock extends BGPSessionImpl {
21
22         private final BGPSessionListener client;
23
24         SpeakerSessionMock(final BGPSessionListener listener, final BGPSessionListener client) {
25                 super(new MockDispatcher(), new Timer(), new BGPConnectionImpl(null, listener, new BGPSessionPreferences(new ASNumber(30), (short) 15, null, null), new BGPSessionProposalCheckerImpl()), 3, null, null);
26                 this.client = client;
27         }
28
29         @Override
30         public void sendMessage(final BGPMessage msg) {
31                 this.lastMessageSentAt = System.nanoTime();
32                 this.client.onMessage(msg);
33         }
34 }