TransportPacketFactoryImpl implements TransportPacketFactory { @Override public UDPPacket createUDP(final long ts, final Buffer payload) throws IllegalArgumentException, IllegalProtocolException { return createUdpInternal(ts, payload); } TransportPacketFactoryImpl(final PacketFactory factory); @Override TransportPacket create(final Protocol protocol, final String srcAddress, final int srcPort,
            final String destAddress, final int destPort,
            final Buffer payload); @Override TransportPacket create(final Protocol protocol, final byte[] srcAddress, final int srcPort,
            final byte[] destAddress, final int destPort, final Buffer payload); @Override UDPPacket createUDP(final long ts, final Buffer payload); @Override UDPPacket createUDP(final Buffer payload);  }
@Test public void testCreateDefaultUDPPacket() throws Exception { final UDPPacket pkt = this.factory.createUDP(Buffers.wrap("this is some random text")); assertThat(((MACPacket)pkt.getPacket(Protocol.ETHERNET_II)).getSourceMacAddress(), is("00:00:00:00:00:00")); assertThat(((MACPacket)pkt.getPacket(Protocol.ETHERNET_II)).getDestinationMacAddress(), is("00:00:00:00:00:00")); assertThat((pkt.getParentPacket()).getSourceIP(), is("127.0.0.1")); assertThat(pkt.getSourcePort(), is(0)); assertThat((pkt.getParentPacket()).getDestinationIP(), is("127.0.0.1")); assertThat(pkt.getDestinationPort(), is(0)); assertThat(pkt.getPayload().toString(), is("this is some random text")); }