Пример #1
0
  public static Module newTestLanternModule() {
    final LanternModule lm = new LanternModule();
    lm.setLocalCipherProvider(new DefaultLocalCipherProvider());
    lm.setEncryptedFileService(new UnencryptedFileService());
    lm.setGeoIpLookupService(new GeoIpLookupService(false));
    lm.setUpnpService(
        new UpnpService() {
          @Override
          public void shutdown() {}

          @Override
          public void removeUpnpMapping(int mappingIndex) {}

          @Override
          public int addUpnpMapping(
              PortMappingProtocol protocol,
              int localPort,
              int externalPortRequested,
              PortMapListener portMapListener) {
            return 0;
          }
        });
    lm.setNatPmpService(
        new NatPmpService() {

          @Override
          public void shutdown() {}

          @Override
          public void removeNatPmpMapping(int mappingIndex) {}

          @Override
          public int addNatPmpMapping(
              PortMappingProtocol protocol,
              int localPort,
              int externalPortRequested,
              PortMapListener portMapListener) {
            return 0;
          }
        });
    return Modules.override(lm).with(new TestModule());
  }
Пример #2
0
  public static LanternModule newTestLanternModule() throws Exception {
    final LanternModule lm = new LanternModule(new String[] {});
    lm.setGeoIpLookupService(new GeoIpLookupService());
    lm.setUpnpService(
        new UpnpService() {
          @Override
          public void shutdown() {}

          @Override
          public void removeUpnpMapping(int mappingIndex) {}

          @Override
          public int addUpnpMapping(
              PortMappingProtocol protocol,
              int localPort,
              int externalPortRequested,
              PortMapListener portMapListener) {
            return 0;
          }
        });
    lm.setNatPmpService(
        new NatPmpService() {

          @Override
          public void shutdown() {}

          @Override
          public void removeNatPmpMapping(int mappingIndex) {}

          @Override
          public int addNatPmpMapping(
              PortMappingProtocol protocol,
              int localPort,
              int externalPortRequested,
              PortMapListener portMapListener) {
            return 0;
          }
        });
    // return Modules.override(lm).with(new TestModule());
    return lm;
  }