1, Create (at least) two classes. One for UDP and one for TCP. It would omit lots of code like this:
if (this.Type == ServerType.TCP) { ...} else if (this.Type == ServerType.UDP) { ...}Maybe a common abstract parent class and a factory are also required.
2, Anyway, in the following snippet the last else branch should throw an exception:
if (this.Type == ServerType.TCP) { ...} else if (this.Type == ServerType.UDP) { ...} else { return null;}I don't think that there is any state when Type != TCP and Type != UDP too.