use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration in project incubator-pulsar by apache.
the class ProxyPublishConsumeWithoutZKTest method setup.
@BeforeMethod
public void setup() throws Exception {
super.internalSetup();
super.producerBaseSetup();
port = PortManager.nextFreePort();
WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
config.setWebServicePort(port);
config.setClusterName("use");
config.setServiceUrl(pulsar.getWebServiceAddress());
config.setServiceUrlTls(pulsar.getWebServiceAddressTls());
service = spy(new WebSocketService(config));
doReturn(mockZooKeeperClientFactory).when(service).getZooKeeperClientFactory();
proxyServer = new ProxyServer(config);
WebSocketServiceStarter.start(proxyServer, service);
log.info("Proxy Server Started");
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration in project incubator-pulsar by apache.
the class LookupProtocolTest method httpLookupTest.
@Test(timeOut = 10000)
public void httpLookupTest() throws Exception {
WebSocketProxyConfiguration conf = new WebSocketProxyConfiguration();
conf.setServiceUrl("http://localhost:8080");
conf.setServiceUrlTls("https://localhost:8443");
WebSocketService service = new WebSocketService(conf);
PulsarClientImpl testClient = (PulsarClientImpl) service.getPulsarClient();
Field lookupField = PulsarClientImpl.class.getDeclaredField("lookup");
lookupField.setAccessible(true);
Assert.assertEquals(lookupField.get(testClient).getClass().getName(), "org.apache.pulsar.client.impl.HttpLookupService");
Assert.assertFalse(testClient.getConfiguration().isUseTls());
service.close();
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration in project incubator-pulsar by apache.
the class LookupProtocolTest method httpsLookupTest.
@Test(timeOut = 10000)
public void httpsLookupTest() throws Exception {
WebSocketProxyConfiguration conf = new WebSocketProxyConfiguration();
conf.setServiceUrl("http://localhost:8080");
conf.setServiceUrlTls("https://localhost:8443");
conf.setBrokerServiceUrl("pulsar://localhost:6650");
conf.setTlsEnabled(true);
WebSocketService service = new WebSocketService(conf);
PulsarClientImpl testClient = (PulsarClientImpl) service.getPulsarClient();
Field lookupField = PulsarClientImpl.class.getDeclaredField("lookup");
lookupField.setAccessible(true);
Assert.assertEquals(lookupField.get(testClient).getClass().getName(), "org.apache.pulsar.client.impl.HttpLookupService");
Assert.assertTrue(testClient.getConfiguration().isUseTls());
service.close();
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration in project incubator-pulsar by apache.
the class LookupProtocolTest method binaryTlsLookupTest.
@Test(timeOut = 10000)
public void binaryTlsLookupTest() throws Exception {
WebSocketProxyConfiguration conf = new WebSocketProxyConfiguration();
conf.setServiceUrl("http://localhost:8080");
conf.setServiceUrlTls("https://localhost:8443");
conf.setBrokerServiceUrl("pulsar://localhost:6650");
conf.setBrokerServiceUrlTls("pulsar+ssl://localhost:6651");
conf.setTlsEnabled(true);
WebSocketService service = new WebSocketService(conf);
PulsarClientImpl testClient = (PulsarClientImpl) service.getPulsarClient();
Field lookupField = PulsarClientImpl.class.getDeclaredField("lookup");
lookupField.setAccessible(true);
Assert.assertEquals(lookupField.get(testClient).getClass().getName(), "org.apache.pulsar.client.impl.BinaryProtoLookupService");
Assert.assertTrue(testClient.getConfiguration().isUseTls());
service.close();
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration in project incubator-pulsar by apache.
the class LookupProtocolTest method binaryLookupTest.
@Test(timeOut = 10000)
public void binaryLookupTest() throws Exception {
WebSocketProxyConfiguration conf = new WebSocketProxyConfiguration();
conf.setServiceUrl("http://localhost:8080");
conf.setServiceUrlTls("https://localhost:8443");
conf.setBrokerServiceUrl("pulsar://localhost:6650");
conf.setBrokerServiceUrlTls("pulsar+ssl://localhost:6651");
WebSocketService service = new WebSocketService(conf);
PulsarClientImpl testClient = (PulsarClientImpl) service.getPulsarClient();
Field lookupField = PulsarClientImpl.class.getDeclaredField("lookup");
lookupField.setAccessible(true);
Assert.assertEquals(lookupField.get(testClient).getClass().getName(), "org.apache.pulsar.client.impl.BinaryProtoLookupService");
Assert.assertFalse(testClient.getConfiguration().isUseTls());
service.close();
}
Aggregations