private Object inOut(Type type, Format format, Object value) throws IOException, SQLException {
value = coerceValue(type, format, value);
Codec codec = type.getCodec(format);
ByteBuf buffer = Unpooled.buffer();
codec.encoder.encode(type, buffer, value, conn);
Object res = codec.decoder.decode(type, null, null, buffer, conn);