MediaChannel { public RTPFormats getFormats() { if(this.negotiated) { return this.negotiatedFormats; } return this.supportedFormats; } protected  MediaChannel(String mediaType, Clock wallClock, ChannelsManager channelsManager); String getMediaType(); long getSsrc(); void setSsrc(long ssrc); String getCname(); void setCname(String cname); String getExternalAddress(); String getRtpAddress(); int getRtpPort(); String getRtcpAddress(); int getRtcpPort(); void open(); void close(); boolean isOpen(); boolean isAvailable(); void setInputDsp(Processor dsp); Processor getInputDsp(); void setOutputDsp(Processor dsp); Processor getOutputDsp(); void setConnectionMode(ConnectionMode mode); RTPFormats getFormats(); RTPFormats getFormatMap(); void bind(boolean isLocal, boolean rtcpMux); boolean isRtcpMux(); void connectRtp(SocketAddress address); void connectRtp(String address, int port); void bindRtcp(boolean isLocal, int port); void connectRtcp(SocketAddress remoteAddress); void connectRtcp(String address, int port); RTPFormats getNegotiatedFormats(); boolean hasNegotiatedFormats(); void negotiateFormats(MediaDescriptionField media); boolean containsNegotiatedFormats(); void enableICE(String externalAddress, boolean rtcpMux); void disableICE(); boolean isIceEnabled(); String getIceUfrag(); String getIcePwd(); void enableDTLS(String hashFunction, String remoteFingerprint); void enableDTLS(); void setRemoteFingerprint(String hashFunction, String fingerprint); void disableDTLS(); boolean isDtlsEnabled(); String getDtlsFingerprint(); long getPacketsReceived(); long getOctetsReceived(); long getPacketsSent(); long getOctetsSent(); long getJitter();  }
@Test public void testSupportedCodecsFiltering() { final RTPFormats codecs = new RTPFormats(3); codecs.add(AVProfile.audio.find(0)); codecs.add(AVProfile.audio.find(8)); codecs.add(AVProfile.audio.find(3)); codecs.add(AVProfile.audio.find(101)); final ChannelsManager channelProvider = mock(ChannelsManager.class); final RtpChannel rtpChannel = mock(RtpChannel.class); final RtcpChannel rtcpChannel = mock(RtcpChannel.class); final Clock clock = mock(Clock.class); when(channelProvider.getCodecs()).thenReturn(codecs); when(channelProvider.getRtpChannel(any(RtpStatistics.class), any(RtpClock.class), any(RtpClock.class))).thenReturn(rtpChannel); when(channelProvider.getRtcpChannel(any(RtpStatistics.class))).thenReturn(rtcpChannel); final AudioChannel audioChannel = new AudioChannel(clock, channelProvider); RTPFormats supportedCodecs = audioChannel.getFormats(); assertEquals(codecs, supportedCodecs); }