@Test public void create() { RestP2pClientFactory factory = new RestP2pClientFactory(); assertThat(factory.communicationType()).isEqualTo(CommunicationType.REST); Config config = mock(Config.class); ServerConfig serverConfig = mock(ServerConfig.class); URI uri = URI.create("unix:/file"); when(serverConfig.getServerUri()).thenReturn(uri); when(serverConfig.getBindingUri()).thenReturn(uri); when(serverConfig.getApp()).thenReturn(AppType.Q2T); when(serverConfig.getCommunicationType()).thenReturn(CommunicationType.REST); when(serverConfig.isSsl()).thenReturn(Boolean.FALSE); when(config.getP2PServerConfig()).thenReturn(serverConfig); P2pClient result = factory.create(config); assertThat(result).isNotNull(); }
@Override public P2pClient create(Config config) { SSLContextFactory clientSSLContextFactory = ClientSSLContextFactory.create(); ClientFactory clientFactory = new ClientFactory(clientSSLContextFactory); Client client = clientFactory.buildFrom(config.getP2PServerConfig()); return new RestP2pClient(client); }
RestP2pClientFactory implements P2pClientFactory { @Override public P2pClient create(Config config) { SSLContextFactory clientSSLContextFactory = ClientSSLContextFactory.create(); ClientFactory clientFactory = new ClientFactory(clientSSLContextFactory); Client client = clientFactory.buildFrom(config.getP2PServerConfig()); return new RestP2pClient(client); } }
RestP2pClientFactory implements P2pClientFactory { @Override public P2pClient create(Config config) { SSLContextFactory clientSSLContextFactory = ClientSSLContextFactory.create(); ClientFactory clientFactory = new ClientFactory(clientSSLContextFactory); Client client = clientFactory.buildFrom(config.getP2PServerConfig()); return new RestP2pClient(client); }  }
RestP2pClientFactory implements P2pClientFactory { @Override public P2pClient create(Config config) { SSLContextFactory clientSSLContextFactory = ClientSSLContextFactory.create(); ClientFactory clientFactory = new ClientFactory(clientSSLContextFactory); Client client = clientFactory.buildFrom(config.getP2PServerConfig()); return new RestP2pClient(client); }  @Override P2pClient create(Config config); @Override CommunicationType communicationType(); }
RestP2pClientFactory implements P2pClientFactory { @Override public P2pClient create(Config config) { SSLContextFactory clientSSLContextFactory = ClientSSLContextFactory.create(); ClientFactory clientFactory = new ClientFactory(clientSSLContextFactory); Client client = clientFactory.buildFrom(config.getP2PServerConfig()); return new RestP2pClient(client); }  @Override P2pClient create(Config config); @Override CommunicationType communicationType();  }