use of net.mm2d.upnp.SsdpSearchServer.ResponseListener in project mmupnp by ohmae.
the class SsdpSearchServerTest method onReceive_データに問題がある場合listenerコールされない.
@Test
public void onReceive_データに問題がある場合listenerコールされない() throws Exception {
final NetworkInterface networkInterface = NetworkUtils.getAvailableInet4Interfaces().get(0);
final SsdpSearchServer server = new SsdpSearchServer(Address.IP_V4, networkInterface);
final ResponseListener listener = mock(ResponseListener.class);
server.setResponseListener(listener);
final InetAddress address = InetAddress.getByName("192.0.2.2");
final byte[] data = new byte[0];
server.onReceive(address, data, data.length);
verify(listener, never()).onReceiveResponse(ArgumentMatchers.any(SsdpResponse.class));
}
use of net.mm2d.upnp.SsdpSearchServer.ResponseListener in project mmupnp by ohmae.
the class SsdpSearchServerListTest method openAndStart.
@Test
public void openAndStart() throws Exception {
final SsdpSearchServerList list = spy(new SsdpSearchServerList());
final SsdpSearchServer server = mock(SsdpSearchServer.class);
final ResponseListener listener = mock(ResponseListener.class);
doReturn(server).when(list).newSsdpSearchServer(eq(Address.IP_V4), any(NetworkInterface.class), eq(listener));
final NetworkInterface nif = NetworkUtils.getAvailableInet4Interfaces().get(0);
list.init(Protocol.DEFAULT, Arrays.asList(nif), listener);
list.openAndStart();
verify(server, times(1)).open();
verify(server, times(1)).start();
}
use of net.mm2d.upnp.SsdpSearchServer.ResponseListener in project mmupnp by ohmae.
the class SsdpSearchServerListTest method stop.
@Test
public void stop() {
final SsdpSearchServerList list = spy(new SsdpSearchServerList());
final SsdpSearchServer server = mock(SsdpSearchServer.class);
final ResponseListener listener = mock(ResponseListener.class);
doReturn(server).when(list).newSsdpSearchServer(eq(Address.IP_V4), any(NetworkInterface.class), eq(listener));
final NetworkInterface nif = NetworkUtils.getAvailableInet4Interfaces().get(0);
list.init(Protocol.DEFAULT, Arrays.asList(nif), listener);
list.stop();
verify(server, times(1)).stop();
}
use of net.mm2d.upnp.SsdpSearchServer.ResponseListener in project mmupnp by ohmae.
the class SsdpSearchServerListTest method close.
@Test
public void close() {
final SsdpSearchServerList list = spy(new SsdpSearchServerList());
final SsdpSearchServer server = mock(SsdpSearchServer.class);
final ResponseListener listener = mock(ResponseListener.class);
doReturn(server).when(list).newSsdpSearchServer(eq(Address.IP_V4), any(NetworkInterface.class), eq(listener));
final NetworkInterface nif = NetworkUtils.getAvailableInet4Interfaces().get(0);
list.init(Protocol.DEFAULT, Arrays.asList(nif), listener);
list.close();
verify(server, times(1)).close();
}
Aggregations