@RunWith(MockitoJUnitRunner.class)
public class HandshakeListenerImplTest {
- private final Short version = OFConstants.OFP_VERSION_1_3;
-
@Mock
private DeviceConnectedHandler deviceConnectedHandler;
@Mock
@Test
public void testOnHandshakeSuccessfull() throws Exception {
- handshakeListener.onHandshakeSuccessful(features, version);
+ handshakeListener.onHandshakeSuccessful(features, OFConstants.OFP_VERSION_1_3);
Mockito.verify(connectionContextSpy).changeStateToWorking();
Mockito.verify(connectionContextSpy).setFeatures(Matchers.any(FeaturesReply.class));
Mockito.verify(connectionContextSpy).setNodeId(nodeIdCaptor.capture());
+ Mockito.verify(connectionContextSpy).handshakeSuccessful();
Mockito.verify(deviceConnectedHandler).deviceConnected(connectionContextSpy);
Mockito.verify(handshakeContext).close();
@Test
public void testOnHandshakeFailure2() throws Exception {
Mockito.when(connectionAdapter.getRemoteAddress()).thenReturn(InetSocketAddress.createUnresolved("ut-ofp.example.org", 4242));
+ connectionContextSpy.setNodeId(new NodeId("openflow:1"));
handshakeListener.onHandshakeFailure();
Mockito.verify(handshakeContext).close();
Mockito.verify(connectionContextSpy).closeConnection(false);