AkkaSocketFactory implements SocketFactory { void applySocketOptions(Socket socket) { if (highWaterMark >= 0) { socket.setHWM(highWaterMark); } if (linger >= 0) { socket.setLinger(linger); } } AkkaSocketFactory(long highWaterMark, long linger); @Override Socket createConsumerSocket(Context context, ZeromqSocketType socketType); @Override Socket createProducerSocket(Context context, ZeromqSocketType socketType);  }
@Test public void testOptionsApplied() { Socket socket = mock(Socket.class); new AkkaSocketFactory(100, 200).applySocketOptions(socket); verify(socket).setHWM(100); verify(socket).setLinger(200); socket = mock(Socket.class); new AkkaSocketFactory(100, -1).applySocketOptions(socket); verify(socket).setHWM(100); socket = mock(Socket.class); new AkkaSocketFactory(-1, 200).applySocketOptions(socket); verify(socket).setLinger(200); }