### Question:
RlpxAgent { public void subscribeMessage(final Capability capability, final MessageCallback callback) { connectionEvents.subscribeMessage(capability, callback); } private  RlpxAgent(
      final LocalNode localNode,
      final PeerConnectionEvents connectionEvents,
      final ConnectionInitializer connectionInitializer,
      final PeerRlpxPermissions peerPermissions,
      final PeerPrivileges peerPrivileges,
      final int maxConnections,
      final int maxRemotelyInitiatedConnections,
      final MetricsSystem metricsSystem); static Builder builder(); CompletableFuture<Integer> start(); CompletableFuture<Void> stop(); Stream<? extends PeerConnection> streamConnections(); int getConnectionCount(); void connect(final Stream<? extends Peer> peerStream); void disconnect(final Bytes peerId, final DisconnectReason reason); Optional<CompletableFuture<PeerConnection>> getPeerConnection(final Peer peer); CompletableFuture<PeerConnection> connect(final Peer peer); void subscribeMessage(final Capability capability, final MessageCallback callback); void subscribeConnect(final ConnectCallback callback); void subscribeDisconnect(final DisconnectCallback callback);  }### Answer:
@Test public void subscribeMessage() throws ExecutionException, InterruptedException, PeerConnection.PeerNotConnected { final Peer peer = createPeer(); final Capability cap = Capability.create("eth", 63); startAgent(); final AtomicBoolean eventFired = new AtomicBoolean(false); agent.subscribeMessage(cap, (capability, msg) -> eventFired.set(true)); final PeerConnection connection = agent.connect(peer).get(); peerConnectionEvents.dispatchMessage( Capability.create("eth", 63), connection, PingMessage.get()); assertThat(eventFired).isTrue(); }