summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/background/EndpointFactory.cs
blob: 157862c7eaa8d6b953c0a86685c80514b178d3a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// **********************************************************************
//
// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

using System.Collections.Generic;
using System.Diagnostics;

internal class EndpointFactory : IceInternal.EndpointFactory
{
    internal EndpointFactory(IceInternal.EndpointFactory factory)
    {
        _factory = factory;
    }

    public short type()
    {
        return (short)(EndpointI.TYPE_BASE + _factory.type());
    }

    public string protocol()
    {
        return "test-" + _factory.protocol();
    }

    public IceInternal.EndpointI create(List<string> args, bool server)
    {
        return new EndpointI(_factory.create(args, server));
    }

    public IceInternal.EndpointI read(Ice.InputStream s)
    {
        short type = s.readShort();
        Debug.Assert(type == _factory.type());

        s.startEncapsulation();
        IceInternal.EndpointI endpoint = new EndpointI(_factory.read(s));
        s.endEncapsulation();
        return endpoint;
    }

    public void destroy()
    {
    }

    public IceInternal.EndpointFactory clone(IceInternal.ProtocolInstance instance)
    {
        return this;
    }

    private IceInternal.EndpointFactory _factory;
}