This commit is contained in:
@@ -68,11 +68,11 @@ public class SncpTest {
|
|||||||
|
|
||||||
public static ObjectPool<ByteBuffer> newBufferPool() {
|
public static ObjectPool<ByteBuffer> newBufferPool() {
|
||||||
return new ObjectPool<>(new AtomicLong(), new AtomicLong(), 16,
|
return new ObjectPool<>(new AtomicLong(), new AtomicLong(), 16,
|
||||||
(Object... params) -> ByteBuffer.allocateDirect(8192), null, (e) -> {
|
(Object... params) -> ByteBuffer.allocateDirect(8192), null, (e) -> {
|
||||||
if (e == null || e.isReadOnly() || e.capacity() != 8192) return false;
|
if (e == null || e.isReadOnly() || e.capacity() != 8192) return false;
|
||||||
e.clear();
|
e.clear();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void runClient() throws Exception {
|
private static void runClient() throws Exception {
|
||||||
@@ -81,7 +81,7 @@ public class SncpTest {
|
|||||||
set.add(addr);
|
set.add(addr);
|
||||||
if (port2 > 0) set.add(new InetSocketAddress(myhost, port2));
|
if (port2 > 0) set.add(new InetSocketAddress(myhost, port2));
|
||||||
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
|
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
|
||||||
final Transport transport = new Transport("", WatchFactory.root(), newBufferPool(), newChannelGroup(), null, set);
|
final Transport transport = new Transport("", WatchFactory.root(), "", newBufferPool(), newChannelGroup(), null, set);
|
||||||
final SncpTestService service = Sncp.createRemoteService(serviceName, null, SncpTestService.class, null, transport);
|
final SncpTestService service = Sncp.createRemoteService(serviceName, null, SncpTestService.class, null, transport);
|
||||||
ResourceFactory.root().inject(service);
|
ResourceFactory.root().inject(service);
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class SncpTest {
|
|||||||
Set<InetSocketAddress> set = new LinkedHashSet<>();
|
Set<InetSocketAddress> set = new LinkedHashSet<>();
|
||||||
if (port2 > 0) set.add(new InetSocketAddress(myhost, port2));
|
if (port2 > 0) set.add(new InetSocketAddress(myhost, port2));
|
||||||
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
|
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
|
||||||
final Transport transport = new Transport("", WatchFactory.root(), newBufferPool(), newChannelGroup(), null, set);
|
final Transport transport = new Transport("", WatchFactory.root(), "", newBufferPool(), newChannelGroup(), null, set);
|
||||||
SncpTestService service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, addr, transport, null);
|
SncpTestService service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, addr, transport, null);
|
||||||
ResourceFactory.root().inject(service);
|
ResourceFactory.root().inject(service);
|
||||||
server.addService(new ServiceWrapper(service, "", "", new HashSet<>(), null));
|
server.addService(new ServiceWrapper(service, "", "", new HashSet<>(), null));
|
||||||
@@ -185,7 +185,7 @@ public class SncpTest {
|
|||||||
Set<InetSocketAddress> set = new LinkedHashSet<>();
|
Set<InetSocketAddress> set = new LinkedHashSet<>();
|
||||||
set.add(new InetSocketAddress(myhost, port));
|
set.add(new InetSocketAddress(myhost, port));
|
||||||
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
|
//String name, WatchFactory, ObjectPool<ByteBuffer>, AsynchronousChannelGroup, InetSocketAddress clientAddress, Collection<InetSocketAddress>
|
||||||
final Transport transport = new Transport("", WatchFactory.root(), newBufferPool(), newChannelGroup(), null, set);
|
final Transport transport = new Transport("", WatchFactory.root(), "", newBufferPool(), newChannelGroup(), null, set);
|
||||||
Service service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, addr, transport, null);
|
Service service = Sncp.createLocalService("", null, ResourceFactory.root(), SncpTestService.class, addr, transport, null);
|
||||||
server.addService(new ServiceWrapper(service, "", "", new HashSet<>(), null));
|
server.addService(new ServiceWrapper(service, "", "", new HashSet<>(), null));
|
||||||
AnyValue.DefaultAnyValue conf = new AnyValue.DefaultAnyValue();
|
AnyValue.DefaultAnyValue conf = new AnyValue.DefaultAnyValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user