RtpFactory { public RtpSocket getRTPSocket() { RtpSocket rtpSocket = new RtpSocket(transceiver, timer, formatMap, this); return rtpSocket; } RtpFactory(); int getLocalPort(); void setLocalPort(int localPort); String getStunAddress(); void setStunAddress(String address); void start(); void stop(); Timer getTimer(); void setTimer(Timer timer); String getBindAddress(); void setBindAddress(String bindAddress); Integer getJitter(); void setJitter(Integer jitter); RtpSocket getRTPSocket(); void releaseRTPSocket(RtpSocket rtpSocket); Map<Integer, Format> getFormatMap(); void setFormatMap(Map<Integer, Format> originalFormatMap);  }
@Test public void getRTPSocketTest() throws Exception { RtpSocket rtpSocket = factory.getRTPSocket(); int port = rtpSocket.getLocalPort(); assertEquals(9201, port); assertEquals(80, rtpSocket.getJitter()); HashMap<Integer, Format> format = rtpSocket.getRtpMap(); assertEquals(2, format.size()); format.remove(0); rtpSocket.setRtpMap(format); assertEquals(1, rtpSocket.getRtpMap().size()); rtpSocket.release(); RtpSocket rtpSocket2 = factory.getRTPSocket(); assertEquals(2, rtpSocket2.getRtpMap().size()); }