Check.notNull(socketFactory);
Check.notNull(socketAddress);
return new Client(methodMapperFactory) {
@Override protected Object invoke(final ClientInvocation invocation) throws Throwable {
try (Socket socket = connectSocket(socketFactory, socketAddress)) {
return invocation.invoke(Interceptors.threadLocal(SOCKET, socket), new Tunnel() {
@Override public Reply invoke(final Request request) throws Exception {
setTcpNoDelay(socket);
write(request, socket, messageSerializer);
return invocation.oneWay ? null : (Reply)read(socket, messageSerializer);
}