net.i2p.router.dummy

## Class VMCommSystem

- java.lang.Object
- - net.i2p.router.CommSystemFacade
  - - net.i2p.router.dummy.VMCommSystem

- All Implemented Interfaces:
    Service

      public class VMCommSystem
      extends CommSystemFacade

  Hacked up in-VM comm system for talking between contexts within the same Java virtual machine. It doesn't generate any routerAddresses, but instead tracks the peers through a singleton. It cannot connect to anything outside of its own Java VM. It does not implement TCP, UDP, and therefore no NTCP or SSU. Currently, the comm system doesn't even inject any lag, though it could (later). It does honor the standard transport stats though, but no TCP or UDP specific ones (since UDP and TCP are not implemented). Typically, VMCommSystem is enabled by developers when it is desirable to test the router without enabling a real comm system. For a variety of testing purposes, it can be advantageous to start the router in a mode where contact with the actual network is disabled. VMCommSystem can be enabled with the following setting in the router.config file: i2p.vmCommSystem=true FOR DEBUGGING AND LOCAL TESTING ONLY.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.i2p.router.CommSystemFacade

      `CommSystemFacade.Status`

  - ### Field Summary

    - ### Fields inherited from class net.i2p.router.CommSystemFacade

      `ROUTER_BUNDLE_NAME, STATUS_DIFFERENT, STATUS_DISCONNECTED, STATUS_HOSED, STATUS_IPV4_DISABLED_IPV6_FIREWALLED, STATUS_IPV4_DISABLED_IPV6_OK, STATUS_IPV4_DISABLED_IPV6_UNKNOWN, STATUS_IPV4_FIREWALLED_IPV6_OK, STATUS_IPV4_FIREWALLED_IPV6_UNKNOWN, STATUS_IPV4_OK_IPV6_FIREWALLED, STATUS_IPV4_OK_IPV6_UNKNOWN, STATUS_IPV4_SNAT_IPV6_OK, STATUS_IPV4_SNAT_IPV6_UNKNOWN, STATUS_IPV4_UNKNOWN_IPV6_FIREWALLED, STATUS_IPV4_UNKNOWN_IPV6_OK, STATUS_OK, STATUS_REJECT_UNSOLICITED, STATUS_UNKNOWN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VMCommSystem(RouterContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `countActivePeers()` How many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.
    `int` | `countActiveSendPeers()` How many peers are we currently connected to, that we have sent a message to in the last minute.
    `List<Hash>` | `getEstablished()` Get all the peers we are connected to.
    `X25519KeyFactory` | `getXDHFactory()` Factory for making X25519 key pairs.
    `boolean` | `isEstablished(Hash peer)`
    `void` | `processMessage(OutNetMessage msg)` The router wants us to send the given message to the peer.
    `void` | `receive(byte[] message, Hash fromPeer)` We send messages between comms as bytes so that we strip any router-local info.
    `void` | `renderStatusHTML(Writer out, String urlBase, int sortFlags)`
    `void` | `restart()` Perform a soft restart.
    `void` | `shutdown()` Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully.
    `void` | `startup()` Instruct the service that it should start normal operation.

    - ### Methods inherited from class net.i2p.router.CommSystemFacade

      `createAddresses, exemptIncoming, forceDisconnect, getCanonicalHostName, getCanonicalHostNameSync, getCountries, getCountry, getCountryName, getFramedAveragePeerClockSkew, getIP, getLocalizedStatusString, getMedianPeerClockSkew, getMostRecentErrorMessages, getOurCountry, getStatus, getTransports, haveHighOutboundCapacity, haveInboundCapacity, haveOutboundCapacity, initGeoIP, isBacklogged, isDummy, isExemptIncoming, isInStrictCountry, isInStrictCountry, isInStrictCountry, isRunning, mayDisconnect, notifyRemoveAddress, notifyRemoveAddress, notifyReplaceAddress, queueLookup, registerTransport, removeExemption, renderPeerCaps, renderPeerFlag, renderPeerHTML, renderStatusHTML, unregisterTransport, wasUnreachable`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VMCommSystem

          public VMCommSystem(RouterContext context)

  - ### Method Detail

    - #### countActivePeers

          public int countActivePeers()

      Description copied from class: `CommSystemFacade`
      How many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.
      Specified by:
        `countActivePeers` in class `CommSystemFacade`

    - #### countActiveSendPeers

          public int countActiveSendPeers()

      Description copied from class: `CommSystemFacade`
      How many peers are we currently connected to, that we have sent a message to in the last minute. Unused for anything, to be removed.
      Specified by:
        `countActiveSendPeers` in class `CommSystemFacade`

    - #### getEstablished

          public List<Hash> getEstablished()

      Description copied from class: `CommSystemFacade`
      Get all the peers we are connected to. This should be more efficient than repeated calls to isEstablished() if you have to check a lot.
      Specified by:
        `getEstablished` in class `CommSystemFacade`
      Returns:
        the hashes of all the routers we are connected to, non-null

    - #### getXDHFactory

          public X25519KeyFactory getXDHFactory()

      Factory for making X25519 key pairs.
      Overrides:
        `getXDHFactory` in class `CommSystemFacade`

    - #### isEstablished

          public boolean isEstablished(Hash peer)

      Specified by:
        `isEstablished` in class `CommSystemFacade`

    - #### processMessage

          public void processMessage(OutNetMessage msg)

      The router wants us to send the given message to the peer. Do so, or fire off the failing job.
      Specified by:
        `processMessage` in class `CommSystemFacade`

    - #### receive

          public void receive(byte[] message,
                              Hash fromPeer)

      We send messages between comms as bytes so that we strip any router-local info. For example, a router tags the # attempts to send through a leaseSet, what type of tunnel a tunnelId is bound to, etc.

    - #### renderStatusHTML

          public void renderStatusHTML(Writer out,
                                       String urlBase,
                                       int sortFlags)
                                throws IOException

      Overrides:
        `renderStatusHTML` in class `CommSystemFacade`
      Throws:
        `IOException`

    - #### restart

          public void restart()

      Description copied from interface: `Service`
      Perform a soft restart.

    - #### shutdown

          public void shutdown()

      Description copied from interface: `Service`
      Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully. It should not depend on other components at this point. This call DOES block.

    - #### startup

          public void startup()

      Description copied from interface: `Service`
      Instruct the service that it should start normal operation. This call DOES block until the service is ready.