connectionContextSpy = Mockito.spy(new ConnectionContextImpl(connectionAdapter));
Mockito.when(connectionContextSpy.getConnectionAdapter()).thenReturn(connectionAdapter);
Mockito.when(features.getDatapathId()).thenReturn(BigInteger.TEN);
+ Mockito.doNothing().when(connectionContextSpy).handshakeSuccessful();
handshakeListener = new HandshakeListenerImpl(connectionContextSpy, deviceConnectedHandler);
handshakeListener.setHandshakeContext(handshakeContext);
}
@Test
public void testOnHandshakeSuccessfull() throws Exception {
- handshakeListener.onHandshakeSuccessfull(features, version);
+ handshakeListener.onHandshakeSuccessful(features, version);
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);