use of java.net.InetSocketAddress in project camel by apache.
the class AvroNettyConsumerTest method initializeTranceiver.
@Override
protected void initializeTranceiver() throws IOException {
transceiver = new NettyTransceiver(new InetSocketAddress("localhost", avroPort));
requestor = new SpecificRequestor(KeyValueProtocol.class, transceiver);
transceiverMessageInRoute = new NettyTransceiver(new InetSocketAddress("localhost", avroPortMessageInRoute));
requestorMessageInRoute = new SpecificRequestor(KeyValueProtocol.class, transceiverMessageInRoute);
transceiverForWrongMessages = new NettyTransceiver(new InetSocketAddress("localhost", avroPortForWrongMessages));
requestorForWrongMessages = new SpecificRequestor(KeyValueProtocol.class, transceiverForWrongMessages);
reflectTransceiver = new NettyTransceiver(new InetSocketAddress("localhost", avroPortReflection));
reflectRequestor = new ReflectRequestor(TestReflection.class, reflectTransceiver);
}
use of java.net.InetSocketAddress in project camel by apache.
the class AvroNettyProducerTest method initializeServer.
@Override
protected void initializeServer() {
if (server == null) {
server = new NettyServer(new SpecificResponder(KeyValueProtocol.PROTOCOL, keyValue), new InetSocketAddress("localhost", avroPort));
server.start();
}
if (serverReflection == null) {
serverReflection = new NettyServer(new ReflectResponder(TestReflection.class, testReflection), new InetSocketAddress("localhost", avroPortReflection));
serverReflection.start();
}
}
use of java.net.InetSocketAddress in project camel by apache.
the class HazelcastInstanceConsumerTest method testRemoveInstance.
@Test
public void testRemoveInstance() throws InterruptedException {
MockEndpoint removed = getMockEndpoint("mock:removed");
removed.setExpectedMessageCount(1);
when(member.getSocketAddress()).thenReturn(new InetSocketAddress("foo.bar", 12345));
MembershipEvent event = new MembershipEvent(cluster, member, MembershipEvent.MEMBER_REMOVED, null);
argument.getValue().memberRemoved(event);
assertMockEndpointsSatisfied(5000, TimeUnit.MILLISECONDS);
// check headers
Exchange ex = removed.getExchanges().get(0);
Map<String, Object> headers = ex.getIn().getHeaders();
this.checkHeaders(headers, HazelcastConstants.REMOVED);
}
use of java.net.InetSocketAddress in project camel by apache.
the class HazelcastInstanceConsumerTest method testAddInstance.
@Test
public void testAddInstance() throws InterruptedException {
MockEndpoint added = getMockEndpoint("mock:added");
added.setExpectedMessageCount(1);
when(member.getSocketAddress()).thenReturn(new InetSocketAddress("foo.bar", 12345));
MembershipEvent event = new MembershipEvent(cluster, member, MembershipEvent.MEMBER_ADDED, null);
argument.getValue().memberAdded(event);
assertMockEndpointsSatisfied(5000, TimeUnit.MILLISECONDS);
// check headers
Exchange ex = added.getExchanges().get(0);
Map<String, Object> headers = ex.getIn().getHeaders();
this.checkHeaders(headers, HazelcastConstants.ADDED);
}
use of java.net.InetSocketAddress in project camel by apache.
the class KestrelConfiguration method getInetSocketAddresses.
public List<InetSocketAddress> getInetSocketAddresses() {
List<InetSocketAddress> list = new ArrayList<InetSocketAddress>();
for (String address : addresses) {
String[] tok = address.split(":");
String host;
int port;
if (tok.length == 2) {
host = tok[0];
port = Integer.parseInt(tok[1]);
} else if (tok.length == 1) {
host = tok[0];
port = DEFAULT_KESTREL_PORT;
} else {
throw new IllegalArgumentException("Invalid address: " + address);
}
list.add(new InetSocketAddress(host, port));
}
return list;
}
Aggregations